SonarPlugin implements VisuwallPlugin<SonarConnection> { @Override public SonarConnection getConnection(URL url, Map<String, String> properties) throws ConnectionException { checkNotNull(url, "url is mandatory"); String login = properties.get("login"); String password = properties.get("password"); return sonarConnectionFactory.create(url.toString(), login, password); } SonarPlugin(); @Override SonarConnection getConnection(URL url, Map<String, String> properties); @Override Class<SonarConnection> getConnectionClass(); @Override String getName(); @Override float getVersion(); @Override SoftwareId getSoftwareId(URL url, Map<String, String> properties); @Override String toString(); @Override Map<String, String> getPropertiesWithDefaultValue();  }
@Test public void should_get_connection() throws Exception { SonarConnection mockedConnection = new SonarConnection(); when(sonarConnectionFactory.create(anyString(), anyString(), anyString())).thenReturn(mockedConnection); SonarConnection connection = sonar.getConnection(new URL("http: assertEquals(mockedConnection, connection); }