Browse Source

#32 UnitTest

remotes/origin/JaFi
jannisfingerhut 2 years ago
parent
commit
3c5c5e0ef5
  1. 14
      LernProgramm/testProgramm.java

14
LernProgramm/testProgramm.java

@ -86,6 +86,20 @@ class testProgramm {
assertEquals(1, result, 0); assertEquals(1, result, 0);
} }
@Test
public void testFakultaetWithPositiveNumber() {
String input = "5\n";
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());
System.setIn(in);
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));
FunktionenAusgelagert.Fakultaet();
assertEquals("120\n", out.toString());
}

Loading…
Cancel
Save