We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bec25d commit b94bcc8Copy full SHA for b94bcc8
Fibonacci/FibonacciOutputTest.java
@@ -0,0 +1,22 @@
1
+import static org.junit.Assert.*;
2
+import java.io.*;
3
+import org.junit.Test;
4
+
5
+public class FibonacciOutputTest {
6
7
+ @Test
8
+ public void testConsoleOutputFibonacci() {
9
+ ByteArrayOutputStream outContent = new ByteArrayOutputStream();
10
+ PrintStream originalOut = System.out;
11
+ System.setOut(new PrintStream(outContent));
12
13
+ Fibonacci_series.main(new String[]{});
14
15
+ System.setOut(originalOut);
16
17
+ String expectedOutput = "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181";
18
+ String actualOutput = outContent.toString().trim();
19
20
+ assertEquals(expectedOutput, actualOutput);
21
+ }
22
+}
0 commit comments