Update threads test

This commit is contained in:
RatzzFatzz
2024-11-27 21:19:08 +01:00
parent 1863432dc6
commit 547b5ad86c
2 changed files with 13 additions and 2 deletions

View File

@@ -11,6 +11,10 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import picocli.CommandLine;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.function.Function;
import java.util.stream.Stream;
@@ -44,6 +48,13 @@ class IntegerConfigParameterTest {
Main sut = new Main();
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("-t")));
assertThrows(CommandLine.MissingParameterException.class, () -> CommandLine.populateCommand(sut, args("--threads")));
assertThrows(CommandLine.ParameterException.class, () -> Main.main(args("--threads", "0")));
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
CommandLine underTest = new CommandLine(sut);
underTest = underTest.setErr(printWriter);
underTest.execute(args("-t", "0"));
printWriter.flush();
assertTrue(writer.toString().contains("ERROR: threads must be greater than or equal to 1"));
}
}