@Test public void testCreateViolationWithNoMessage() throws Exception { violationMaker.setCurrentSource("C:\\Sonar\\Example\\Example.Core\\Money.cs"); violationMaker.setCurrentMessage(""); Violation violation = violationMaker.createViolation(); assertThat(violation.getResource().getKey(), is("Example.Core/Money.cs")); assertThat(violation.getMessage(), is("Default Message")); }
@Before public void reinitViolationMaker() { context = mock(SensorContext.class); violationMaker = new GendarmeViolationMaker(env, project, context, resourcesBridge, resourceHelper); violationMaker.setCurrentRule(aRule); violationMaker.setCurrentDefaultViolationMessage("Default Message"); violationMaker.setCurrentTargetName( "Example.Core.IMoney Example.Core.Money::AddMoney(Example.Core.Money)"); violationMaker.setCurrentTargetAssembly( "Example.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); violationMaker.setCurrentLocation( "Example.Core.IMoney Example.Core.Money::AddMoney(Example.Core.Money)"); violationMaker.setCurrentSource(""); violationMaker.setCurrentMessage("Message"); }