### Question:
GridAccountConfigurationProcessor { public static void serializeIRODSAccountListToFile( final File gridAccountFile, final List<IRODSAccount> irodsAccounts) throws GridAccountConfigurationException { if (gridAccountFile == null) { throw new IllegalArgumentException("null gridAccountFile"); } if (irodsAccounts == null) { throw new IllegalArgumentException("null irodsAccounts"); } try { gridAccountFile.delete(); PrintWriter out = new PrintWriter(gridAccountFile); for (IRODSAccount irodsAccount : irodsAccounts) { out.println(buildLineForAccount(irodsAccount)); } out.flush(); out.close(); } catch (IOException e) { throw new GridAccountConfigurationException( "unable to write out to grid account file", e); } }  static void serializeIRODSAccountListToFile(
			final File gridAccountFile, final List<IRODSAccount> irodsAccounts); static List<IRODSAccount> deserializeIRODSAccountListFromFile(
			final File gridAccountFile); static final String DELIM; static final String COMMENT; }### Answer:
@Test(expected = IllegalArgumentException.class) public void testSerializeIRODSAccountListNullAccounts() throws Exception { String testFileName = "testSerializeIRODSAccountListToFile.txt"; String testFileAbsPath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + "/" + testFileName); File testFile = new File(testFileAbsPath); GridAccountConfigurationProcessor.serializeIRODSAccountListToFile( testFile, null); }
@Test public void testSerializeIRODSAccountListToFile() throws Exception { String testFileName = "testSerializeIRODSAccountListToFile.txt"; ArrayList<IRODSAccount> irodsAccounts = new ArrayList<IRODSAccount>(); irodsAccounts.add(testingPropertiesHelper .buildIRODSAccountForIRODSUserFromTestPropertiesForGivenUser( testingProperties, "test", "test")); String testFileAbsPath = scratchFileUtils .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH + "/" + testFileName); File testFile = new File(testFileAbsPath); GridAccountConfigurationProcessor.serializeIRODSAccountListToFile( testFile, irodsAccounts); Assert.assertTrue("file does not exist", testFile.exists()); List<IRODSAccount> actual = GridAccountConfigurationProcessor .deserializeIRODSAccountListFromFile(testFile); IRODSAccount expected = irodsAccounts.get(0); Assert.assertEquals("did not get an account", 1, actual.size()); Assert.assertEquals("bad host", expected.getHost(), actual.get(0) .getHost()); Assert.assertEquals("bad port", expected.getPort(), actual.get(0) .getPort()); Assert.assertEquals("bad zone", expected.getZone(), actual.get(0) .getZone()); Assert.assertEquals("bad user", expected.getUserName(), actual.get(0) .getUserName()); Assert.assertEquals("bad resource", expected .getDefaultStorageResource(), actual.get(0) .getDefaultStorageResource()); Assert.assertEquals("bad home dir", expected.getHomeDirectory(), actual .get(0).getHomeDirectory()); Assert.assertEquals("bad auth type", expected.getAuthenticationScheme(), actual.get(0) .getAuthenticationScheme()); }
@Test(expected = IllegalArgumentException.class) public void testSerializeIRODSAccountListNullFile() throws Exception { ArrayList<IRODSAccount> irodsAccounts = new ArrayList<IRODSAccount>(); GridAccountConfigurationProcessor.serializeIRODSAccountListToFile(null, irodsAccounts); }