|
|
@ -87,8 +87,35 @@ class testProgramm { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testFakultaetWithZero() { |
|
|
|
String input = "0\n"; |
|
|
|
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes()); |
|
|
|
System.setIn(in); |
|
|
|
|
|
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
|
|
System.setOut(new PrintStream(out)); |
|
|
|
|
|
|
|
FunktionenAusgelagert.Fakultaet(); |
|
|
|
|
|
|
|
assertTrue(true); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
public void testSchaltjahr() { |
|
|
|
ByteArrayInputStream in = new ByteArrayInputStream("2000\n".getBytes()); |
|
|
|