File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
table-inheritance/src/test/java Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import static org .junit .jupiter .api .Assertions .assertTrue ;
2+
3+ import com .iluwatar .table .inheritance .App ;
4+ import java .io .ByteArrayOutputStream ;
5+ import java .io .PrintStream ;
6+ import org .junit .jupiter .api .Test ;
7+
8+ class AppTest {
9+
10+ /**
11+ * Tests if the main method runs without throwing exceptions and prints expected output.
12+ */
13+ @ Test
14+ void testAppMainMethod () {
15+
16+ ByteArrayOutputStream outContent = new ByteArrayOutputStream ();
17+ System .setOut (new PrintStream (outContent ));
18+
19+
20+ App .main (new String []{});
21+
22+ String output = outContent .toString ();
23+
24+ assertTrue (output .contains ("Retrieved Vehicle:" ));
25+ assertTrue (output .contains ("Retrieved Car:" ));
26+ assertTrue (output .contains ("Retrieved Truck:" ));
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments