BAEL-6812 Test Main Method with JUnit
- fixed review comments
This commit is contained in:
-4
@@ -40,10 +40,8 @@ public class TestSimpleMain {
|
||||
System.setIn(fips);
|
||||
System.setOut(out);
|
||||
|
||||
//execute
|
||||
SimpleMain.main(arguments);
|
||||
|
||||
//verify
|
||||
String consoleOutput = byteArrayOutputStream.toString(Charset.defaultCharset());
|
||||
assertTrue(consoleOutput.contains("Calculated sum: 6"));
|
||||
|
||||
@@ -63,10 +61,8 @@ public class TestSimpleMain {
|
||||
System.setIn(fips);
|
||||
System.setOut(out);
|
||||
|
||||
//execute
|
||||
SimpleMain.main(arguments);
|
||||
|
||||
//verify
|
||||
String consoleOutput = byteArrayOutputStream.toString(Charset.defaultCharset());
|
||||
assertTrue(consoleOutput.contains("Calculated sum: 10"));
|
||||
|
||||
|
||||
-2
@@ -24,10 +24,8 @@ public class TestStaticMain {
|
||||
|
||||
ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
//execute
|
||||
StaticMain.main(arguments);
|
||||
|
||||
//verify
|
||||
mockedStatic.verify(() -> StaticMain.calculateSum(stringArgumentCaptor.capture()));
|
||||
|
||||
System.setIn(original);
|
||||
|
||||
Reference in New Issue
Block a user