checkProfileCopy("nl");
}
protected void checkProfileCopy(String language) throws FileNotFoundException, IOException {
File originalFile = new File(PROFILE_DIR, language);
final LangProfile originalProfile = readProfileFile(originalFile);
File newFile = File.createTempFile("profile-copy-", null);
FileOutputStream output = null;
try {
output = new FileOutputStream(newFile);
LangProfileFactory.writeProfile(originalProfile, output);
LangProfile newProfile = readProfileFile(newFile);
assertThat(newProfile.getFreq().size(), is(equalTo(originalProfile.getFreq().size())));
assertThat(newProfile.getFreq(), is(equalTo(originalProfile.getFreq())));
assertThat(newProfile.getNWords(), is(equalTo(originalProfile.getNWords())));
assertThat(newProfile.getName(), is(equalTo(originalProfile.getName())));
} finally {
IOUtils.closeQuietly(output);
//noinspection ResultOfMethodCallIgnored
newFile.delete();
}