1 package gov.nasa.jpf.test.basic;
3 import gov.nasa.jpf.util.test.TestJPF;
5 import java.io.ByteArrayOutputStream;
6 import java.io.PrintStream;
11 * This class tests those methods of the ConsolePublisher class that are relevant
12 * to the report.console.start property.
14 * @author Franck van Breugel
16 public class ConsolePublisherTest extends TestJPF {
18 * Runs the tests with the given names.
20 * @param testMethods names of the test methods to be run.
22 public static void main(String[] testMethods) {
23 runTestsOfThisClass(testMethods);
27 * Tests the value dtg for the property report.console.start.
30 public void testDTG(){
31 PrintStream out = System.out;
32 ByteArrayOutputStream stream = new ByteArrayOutputStream();
33 System.setOut(new PrintStream(stream));
34 if (verifyNoPropertyViolation("+report.publisher=console", "+report.console.start=dtg")){
38 assertTrue("output does not contain \"started:\"", stream.toString().contains("started: "));
43 * Tests the value jpf for the property report.console.start.
46 public void testJPF(){
47 PrintStream out = System.out;
48 ByteArrayOutputStream stream = new ByteArrayOutputStream();
49 System.setOut(new PrintStream(stream));
50 if (verifyNoPropertyViolation("+report.publisher=console", "+report.console.start=jpf")){
54 assertTrue("output does not contain \"JavaPathfinder", stream.toString().contains("JavaPathfinder"));
59 * Tests the value platform for the property report.console.start.
62 public void testPlatform(){
63 PrintStream out = System.out;
64 ByteArrayOutputStream stream = new ByteArrayOutputStream();
65 System.setOut(new PrintStream(stream));
66 if (verifyNoPropertyViolation("+report.publisher=console", "+report.console.start=platform")){
70 assertTrue("output does not contain \"hostname:\"", stream.toString().contains("hostname: "));
71 assertTrue("output does not contain \"arch:\"", stream.toString().contains("arch: "));
72 assertTrue("output does not contain \"os:\"", stream.toString().contains("os: "));
73 assertTrue("output does not contain \"java:\"", stream.toString().contains("java: "));
78 * Tests the value sut for the property report.console.start.
81 public void testSUT(){
82 PrintStream out = System.out;
83 ByteArrayOutputStream stream = new ByteArrayOutputStream();
84 System.setOut(new PrintStream(stream));
85 if (verifyNoPropertyViolation("+report.publisher=console", "+report.console.start=sut")){
89 assertTrue("output does not contain \"system under test\"", stream.toString().contains("system under test"));
94 * Tests the value user for the property report.console.start.
97 public void testUser(){
98 PrintStream out = System.out;
99 ByteArrayOutputStream stream = new ByteArrayOutputStream();
100 System.setOut(new PrintStream(stream));
101 if (verifyNoPropertyViolation("+report.publisher=console", "+report.console.start=user")){
105 assertTrue("output does not contain \"user:\"", stream.toString().contains("user: "));