Skip to content

Commit 54cc8d0

Browse files
committed
fix quality (coverage) #2
1 parent 37d4744 commit 54cc8d0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}

0 commit comments

Comments
 (0)