assertThat(stored.getTranslationUnits().size(), is(NUM_TRANS_UNITS));
}
@Test
public void saveTransUnitsWithMetadata() throws Exception {
TransMemory tm = createDefaultTransMemoryInstance();
// add some units
for (int i = 0; i < NUM_TRANS_UNITS; i++) {
TransMemoryUnit unit = new TransMemoryUnit("uid:" + i);
unit.setTranslationMemory(tm);
unit.setSourceLanguage("en-US");
unit.setTransUnitId("unit-id-" + i);
unit.setMetadata(TMMetadataType.TMX14, "Metadata " + i);
tm.getTranslationUnits().add(unit);
}
super.getEm().persist(tm);
// Fetch it, should have the same elements
TransMemory stored = loadTM("new-trans-memory");
assertThat(stored.getTranslationUnits().size(), is(NUM_TRANS_UNITS));
for (TransMemoryUnit tu : tm.getTranslationUnits()) {
assertThat(tu.getMetadata(TMMetadataType.TMX14),
startsWith("Metadata "));
}
}