### Question:
PreferencesDataStore implements DataStoreFactory<String, Credentials>, DataStore<String, Credentials>, CredentialsProvider { @Override public synchronized Credentials put(String key, Credentials credentials) { this.preferences.put(remote, credentialsHelper.convert(credentials)); return get(key); } PreferencesDataStore(Preferences preferences, String remote, CodenvyClient codenvyClient); @Override Credentials get(String key); @Override synchronized Credentials put(String key, Credentials credentials); @Override Credentials delete(String key); @Override DataStore<String, Credentials> getDataStore(String s); @Override Credentials getCredentials(String s);  }### Answer:
@Test(dependsOnMethods = "testGet") public void testPut() throws Exception { init(); Credentials credentialsFlorent = dataStoreFlorent.getCredentials("dummy"); Credentials update = Mockito.mock(Credentials.class); doReturn("toto").when(update).username(); doReturn(credentialsFlorent.token()).when(update).token(); Credentials merged = dataStoreFlorent.put("florent_dev", update); assertEquals(merged.username(), "toto"); }