Here is the code for a simple test case I am doing right now :
private static final ByteArrayOutputStream OUTCONTENT = new ByteArrayOutputStream();
private static final PrintStream OLD_STD_OUT = System.out;
@Before
public void setUp() {
System.setOut(new PrintStream(OUTCONTENT));
}
@After
public void tearDown(){
System.setOut(OLD_STD_OUT);
}
@Test
public void consolePrintResetTest(){
consolePrintReset();
assertEquals("Les statistiques ont été réinitialisées avec succès! \n", OUTCONTENT.toString());
}
and the method I am testing:
public static void consolePrintReset(){
System.out.println("Les statistiques ont été réinitialisées avec succès!");
}
And here a screenshot of what happens: http://puu.sh/vpY3b/9a398d0b41.png
I'm pretty sure it's something really dumb i'm passing over, but I don't find what obvious thing i'm missing to make this test case work. Any help would be greatly appreciated.
Thank you for taking the time to read my question!