### Question:
PlantUmlSequenceDiagramGenerator { public String getPlantUmlScript(List<FixtureCallResult> fixtureCallResults) { String plantUml = "@startuml\n" + style + "\n"; for (FixtureCallResult fixtureCallResut : fixtureCallResults) { plantUml += generateSequence(fixtureCallResut); } plantUml += "@enduml"; return plantUml; }  String getPlantUmlScript(List<FixtureCallResult> fixtureCallResults); String generateInstructionWithParameter(FixtureCall testFixture); public String style; public String succeededColor; public String failedColor; public String ignoredColor; }### Answer:
@Test public void should_generates_aPlantUmlScript() throws Exception { List<FixtureCallResult> fixtureCallResults = new ArrayList<FixtureCallResult>(); String actualScript = tested.getPlantUmlScript(fixtureCallResults); Lines lines = new Lines(actualScript); assertEquals("@startuml", lines.firstLine()); assertEquals("@enduml", lines.lastLine()); }
@Test public void should_addAStyleSequence_withDefaultValue() throws Exception { List<FixtureCallResult> fixtureCallResults = new ArrayList<FixtureCallResult>(); String actualScript = tested.getPlantUmlScript(fixtureCallResults); String actual = new Text(actualScript).after("@startuml\n").until(DEFAULT_STYLE.length()); assertEquals(DEFAULT_STYLE, actual); }
@Test public void should_addASequence_forEachFeatureCallResults() throws Exception { FixtureCallResult fixtureCallResult1 = new FixtureCallResult(new FixtureCall(null, "name1",12,new Fixture(getMethod1(),null),new ArrayList<String>(),0), Issue.SUCCEEDED); FixtureCallResult fixtureCallResult2 = new FixtureCallResult(new FixtureCall(null, "name2",12,new Fixture(getMethod2(),null),new ArrayList<String>(),0), Issue.SUCCEEDED); List<FixtureCallResult> fixtureCallResults = new ArrayList<FixtureCallResult>(); fixtureCallResults.add(fixtureCallResult1); fixtureCallResults.add(fixtureCallResult2); String actualScript = tested.getPlantUmlScript(fixtureCallResults); Lines lines = new Lines(actualScript); assertEquals("alice -[#green]> bob:Method 1", lines.get(12)); assertEquals("bob --[#green]> alice:method2", lines.get(13)); }
@Test public void should_addASequenceColor_dependingTheIssue() throws Exception { FixtureCallResult fixtureCallResult1 = new FixtureCallResult(new FixtureCall(null, "name1",12,new Fixture(getMethod1(),null),new ArrayList<String>(),0), Issue.SUCCEEDED); FixtureCallResult fixtureCallResult2 = new FixtureCallResult(new FixtureCall(null, "name2",12,new Fixture(getMethod2(),null),new ArrayList<String>(),0), Issue.FAILED); FixtureCallResult fixtureCallResult3 = new FixtureCallResult(new FixtureCall(null, "name3",12,new Fixture(getMethod3(),null),new ArrayList<String>(),0), Issue.IGNORED); List<FixtureCallResult> fixtureCallResults = new ArrayList<FixtureCallResult>(); fixtureCallResults.add(fixtureCallResult1); fixtureCallResults.add(fixtureCallResult2); fixtureCallResults.add(fixtureCallResult3); String actualScript = tested.getPlantUmlScript(fixtureCallResults); Lines lines = new Lines(actualScript); assertEquals("alice -"+tested.succeededColor+"> bob:Method 1", lines.get(12)); assertEquals("bob --"+tested.failedColor+"> alice:method2", lines.get(13)); assertEquals("bob -"+tested.ignoredColor+"> bob:Method 3", lines.get(14)); }