JanbaneryFactory { public Janbanery connectAndKeepUsing(String user, String password) throws ServerCommunicationException { DefaultConfiguration conf = new DefaultConfiguration(user, password); RestClient restClient = getRestClient(conf); return new Janbanery(conf, restClient); } JanbaneryFactory();  JanbaneryFactory(AsyncHttpClient asyncHttpClient);  JanbaneryFactory(RestClient restClient); JanbaneryToWorkspace connectUsing(Configuration configuration); JanbaneryToWorkspace connectUsing(String apiKey); JanbaneryToWorkspace connectUsing(String user, String password); Janbanery connectAndKeepUsing(String user, String password); void setAsyncHttpClient(AsyncHttpClient asyncHttpClient); void setEncodedBodyGenerator(ReflectionBodyGenerator encodedBodyGenerator); void setGson(Gson gson);  }
@Test public void shouldConnectAndKeepUsingUserPassMode() throws Exception { Properties properties = new Properties(); properties.load(new FileInputStream(VALID_CONF_FILE_LOCATION)); String user = (String) properties.get("username"); String password = (String) properties.get("password"); janbanery = janbaneryFactory.connectAndKeepUsing(user, password); AuthProvider usedAuthProvider = janbanery.getAuthMode(); assertThat(usedAuthProvider).isInstanceOf(UserPassAuthProvider.class); }