### Question:
CrazyLoginConverter implements Converter { @Override public void execute(CommandSender sender) { String fileName = settings.getProperty(ConverterSettings.CRAZYLOGIN_FILE_NAME); File source = new File(dataFolder, fileName); if (!source.exists()) { sender.sendMessage("CrazyLogin file not found, please put " + fileName + " in AuthMe folder!"); return; } String line; try (BufferedReader users = new BufferedReader(new FileReader(source))) { while ((line = users.readLine()) != null) { if (line.contains("|")) { migrateAccount(line); } } ConsoleLogger.info("CrazyLogin database has been imported correctly"); } catch (IOException ex) { ConsoleLogger.warning("Can't open the crazylogin database file! Does it exist?"); ConsoleLogger.logException("Encountered", ex); } } @Inject  CrazyLoginConverter(@DataFolder File dataFolder, DataSource dataSource, Settings settings); @Override void execute(CommandSender sender);  }### Answer:
@Test public void shouldImportUsers() { given(settings.getProperty(ConverterSettings.CRAZYLOGIN_FILE_NAME)).willReturn("crazylogin.db"); CommandSender sender = mock(CommandSender.class); crazyLoginConverter.execute(sender); ArgumentCaptor<PlayerAuth> authCaptor = ArgumentCaptor.forClass(PlayerAuth.class); verify(dataSource, times(2)).saveAuth(authCaptor.capture()); List<PlayerAuth> savedAuths = authCaptor.getAllValues(); assertNameAndRealName(savedAuths.get(0), "qotato", "qotaTo"); assertThat(savedAuths.get(0).getPassword(), equalToHash("8267663ab198a96437b9f455429a2c1b6c943111613c217bf2703c14d08a309d34e510ddb5549507b1500759dbcf9d4a99bc765ff37b32bd31adbb1e92e74ac5")); assertNameAndRealName(savedAuths.get(1), "bobby", "Bobby"); assertThat(savedAuths.get(1).getPassword(), equalToHash("ad50dbc841e6321210530801f5219a5ffb4c7c41f11878d465374a4b8db2965c50f69b6098918a58e4adea312e3633c7724b15e24a217009e6fa2b3c299d55f2")); }
@Test public void shouldStopForNonExistentFile() { given(settings.getProperty(ConverterSettings.CRAZYLOGIN_FILE_NAME)).willReturn("invalid-file"); CommandSender sender = mock(CommandSender.class); crazyLoginConverter.execute(sender); verifyZeroInteractions(dataSource); verify(sender).sendMessage(argThat(containsString("file not found"))); }