@Test(expected = NullPointerException.class) public void can_t_pass_null_to_create_method() { sonarConnectionFactory.create(null, "", ""); }
public SonarConnection create(String url, String login, String password) { Preconditions.checkNotNull(url, "url is mandatory"); SonarConnection sonarConnection = new SonarConnection(); sonarConnection.connect(url, login, password); return sonarConnection; }
SonarConnectionFactory { public SonarConnection create(String url, String login, String password) { Preconditions.checkNotNull(url, "url is mandatory"); SonarConnection sonarConnection = new SonarConnection(); sonarConnection.connect(url, login, password); return sonarConnection; } }
SonarConnectionFactory { public SonarConnection create(String url, String login, String password) { Preconditions.checkNotNull(url, "url is mandatory"); SonarConnection sonarConnection = new SonarConnection(); sonarConnection.connect(url, login, password); return sonarConnection; }  }
SonarConnectionFactory { public SonarConnection create(String url, String login, String password) { Preconditions.checkNotNull(url, "url is mandatory"); SonarConnection sonarConnection = new SonarConnection(); sonarConnection.connect(url, login, password); return sonarConnection; }  SonarConnection create(String url, String login, String password); }
SonarConnectionFactory { public SonarConnection create(String url, String login, String password) { Preconditions.checkNotNull(url, "url is mandatory"); SonarConnection sonarConnection = new SonarConnection(); sonarConnection.connect(url, login, password); return sonarConnection; }  SonarConnection create(String url, String login, String password);  }