JeffGrigg icon

Untitled

JeffGrigg | PRO | 04/02/21 11:57:00 PM UTC | 0 ⭐ | 12287 👁️ | Never ⏰ | []
Java 5 |

0 B

|

None

|

0 👍

/

0 👎

import junit.framework.TestCase;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
 
public class HelloWorldTest extends TestCase {
    public void testHelloWorld() {
        final var oldSystemOut = System.out;
        final var outputStream = new ByteArrayOutputStream();
        System.setOut(new PrintStream(outputStream));
        try {
            HelloWorld.main(null);
        } finally {
            System.setOut(oldSystemOut);
        }
        assertEquals("Hello world!" + System.lineSeparator(), outputStream.toString());
    }
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎