### Question:
UserConfig extends AbstractConfig { public synchronized void setUsername(final String username) throws IOException { if(username != null && !username.isEmpty()) { setProperty(PROPERTY_USERNAME, username.trim()); } else { removeProperty(PROPERTY_USERNAME); } saveProperties(); } UserConfig(final Path file); synchronized Path getRootPath(); synchronized boolean hasRootPath(); synchronized void setRootPath(final Path path); synchronized String getUsername(); synchronized boolean hasUsername(); synchronized void setUsername(final String username); synchronized String getPassword(); synchronized boolean hasPassword(); synchronized void setPassword(final String password); synchronized String getPin(); synchronized boolean hasPin(); synchronized void setPin(final String pin); synchronized boolean isAutoLoginEnabled(); synchronized void setAutoLogin(boolean enabled);  }### Answer:
@Test public void testSetUsername() throws IOException { userConfig.setUsername(""); assertNull(userConfig.getUsername()); userConfigAssertPersistence(userConfig, configFile); userConfig.setUsername("TestUser123"); assertEquals(userConfig.getUsername(), "TestUser123"); userConfigAssertPersistence(userConfig, configFile); userConfig.setUsername(" JohnDoe "); assertNotEquals(userConfig.getUsername(), " JohnDoe "); assertEquals(userConfig.getUsername(), "JohnDoe"); userConfigAssertPersistence(userConfig, configFile); userConfig.setUsername(null); assertNull(userConfig.getUsername()); userConfigAssertPersistence(userConfig, configFile); }