35 lines
933 B
Plaintext
35 lines
933 B
Plaintext
package {{user_package}};
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.PrintStream;
|
|
|
|
import org.junit.After;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
public class JUnitTweetCounterTest {
|
|
private final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
private final PrintStream oPrintStream = System.out;
|
|
|
|
@Before
|
|
public void setUpStream() {
|
|
System.setOut(new PrintStream(outputStream));
|
|
}
|
|
|
|
@After
|
|
public void restoreStream() {
|
|
System.setOut(oPrintStream);
|
|
}
|
|
|
|
@Test
|
|
public void isTweetCounter() {
|
|
{{user_package}}.TweetCounter.main(null);
|
|
assertEquals("Tweet Length not same", "83", outputStream.toString());
|
|
|
|
String data = {{user_package}}.TweetCounter.Tweet(null);
|
|
assertEquals("tweet in String", "Liz Lemon, ninjas are kind of cool... I just dont know any personally. Get on that.", data);
|
|
}
|
|
}
|