Blame | Last modification | View Log | RSS feed
package test;import static org.junit.Assert.*;import java.io.ByteArrayOutputStream;import java.io.PrintStream;import org.junit.Before;import org.junit.Test;import releaseManager.TeamCity;public class Test_TeamCity{ByteArrayOutputStream buffer = new ByteArrayOutputStream();PrintStream output = new PrintStream(buffer);@Beforepublic void setUp(){output.flush();buffer.reset();}@Testpublic void testStartSuite(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.startSuite("abcdef");// AssertassertEquals("Should be the same", "##teamcity[testSuiteStarted name='abcdef']\n", buffer.toString());}@Testpublic void testStartTest(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.startTest("abcdef");// AssertassertEquals("Should be the same", "##teamcity[testStarted name='abcdef']\n", buffer.toString());}@Testpublic void testFinishTest(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.finishTest("abcdef");// AssertassertEquals("Should be the same", "##teamcity[testFinished name='abcdef']\n", buffer.toString());}@Testpublic void testFinishSuite(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.finishSuite("abcdef");// AssertassertEquals("Should be the same", "##teamcity[testSuiteFinished name='abcdef']\n", buffer.toString());}@Testpublic void testError(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.error("abcdef","qwerty");// AssertassertEquals("Should be the same", "##teamcity[message text='abcdef' errorDetails='qwerty' status='ERROR']\n", buffer.toString());}@Testpublic void testMultilineError(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActteamCity.error("abcdef","qwerty\nLine2");// AssertassertEquals("Should be the same", "##teamcity[message text='abcdef' errorDetails='qwerty|nLine2' status='ERROR']\n", buffer.toString());}@Testpublic void testMessageEncoding(){// ArrangeTeamCity teamCity = new TeamCity(output);// ActString actual = teamCity.encode("a\nb'c\rd|e[f]");// AssertassertEquals("Should be the same", "a|nb|'c|rd||e|[f|]", actual);}}