Assert.assertEquals("German Label should be the new title cache again as English representation is not there anymore", "Deutscher Modifier", newModifier.getTitleCache());
}
- @Test
- @DataSets({
+ @Test
+ @DataSets({
@DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="/eu/etaxonomy/cdm/database/ClearDB_with_Terms_DataSet.xml"),
@DataSet("/eu/etaxonomy/cdm/database/TermsDataSet-with_auditing_info.xml")}
- )
- public void testListByTermType(){
-
- TermType termType = TermType.Modifier;
-
- List<DefinedTermBase> existingList = this.dao.listByTermType(termType, null, null, null, null);
- int nExisting = existingList.size();
- int nExistingTerms = this.dao.list(DefinedTerm.class, null, null, null, null).size();
-
-
- //prepare
- @SuppressWarnings("unchecked")
- TermVocabulary<DefinedTerm> newVoc = TermVocabulary.NewInstance(termType);
- UUID vocUuid = UUID.fromString("6ced4c45-9c1b-4053-9dc3-6b8c51d286ed");
- newVoc.setUuid(vocUuid);
- UUID termUuid = UUID.fromString("2ab69720-c06c-4cfc-8928-d2ae6f1e4a48");
- DefinedTerm newModifier = DefinedTerm.NewModifierInstance("Test Modifier Description", "English Modifier", "TM");
- newModifier.setUuid(termUuid);
- newVoc.addTerm(newModifier);
- vocabularyDao.save(newVoc);
- this.commitAndStartNewTransaction(null);
-
- //assert 1 more
- int nNow = this.dao.listByTermType(termType, null, null, null, null).size();
- Assert.assertEquals("There should be exactly 1 more term now", nExisting + 1 , nNow);
- int nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
- Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
- this.commitAndStartNewTransaction(null);
-
- //Add German representation
- Representation newRepresentation = Representation.NewInstance("Beschreibung", "Deutscher Modifier", "Abk.", Language.GERMAN());
- newModifier.addRepresentation(newRepresentation);
- dao.saveOrUpdate(newModifier);
- this.commitAndStartNewTransaction(null);
-
- nNow = this.dao.listByTermType(termType, null, null, null, null).size();
- Assert.assertEquals("There should still be only one more term (but with 2 representations)", nExisting + 1 , nNow);
- nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
- Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
-
-
- List<DefinedTerm> languages = this.dao.listByTermType(TermType.Language, null, null, null, null);
- Assert.assertNotNull(languages);
- Assert.assertEquals(485, languages.size());
+ )
+ public void testListByTermType(){
+
+ TermType termType = TermType.Modifier;
+
+ List<DefinedTermBase> existingList = this.dao.listByTermType(termType, null, null, null, null);
+ int nExisting = existingList.size();
+ int nExistingTerms = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+
+ //prepare
+ @SuppressWarnings("unchecked")
+ TermVocabulary<DefinedTerm> newVoc = TermVocabulary.NewInstance(termType);
+ UUID vocUuid = UUID.fromString("6ced4c45-9c1b-4053-9dc3-6b8c51d286ed");
+ newVoc.setUuid(vocUuid);
+ UUID termUuid = UUID.fromString("2ab69720-c06c-4cfc-8928-d2ae6f1e4a48");
+ DefinedTerm newModifier = DefinedTerm.NewModifierInstance("Test Modifier Description", "English Modifier", "TM");
+ newModifier.setUuid(termUuid);
+ newVoc.addTerm(newModifier);
+ vocabularyDao.save(newVoc);
+ this.commitAndStartNewTransaction(null);
+
+ //assert 1 more
+ int nNow = this.dao.listByTermType(termType, null, null, null, null).size();
+ Assert.assertEquals("There should be exactly 1 more term now", nExisting + 1 , nNow);
+ int nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+ Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
+ this.commitAndStartNewTransaction(null);
+
+ //Add German representation
+ Representation newRepresentation = Representation.NewInstance("Beschreibung", "Deutscher Modifier", "Abk.", Language.GERMAN());
+ newModifier.addRepresentation(newRepresentation);
+ dao.saveOrUpdate(newModifier);
+ this.commitAndStartNewTransaction(null);
+
+ nNow = this.dao.listByTermType(termType, null, null, null, null).size();
+ Assert.assertEquals("There should still be only one more term (but with 2 representations)", nExisting + 1 , nNow);
+ nTermsNow = this.dao.list(DefinedTerm.class, null, null, null, null).size();
+ Assert.assertEquals("There should be exactly 1 more term now", nExistingTerms + 1 , nTermsNow);
+
+ List<DefinedTerm> languages = this.dao.listByTermType(TermType.Language, null, null, null, null);
+ Assert.assertNotNull(languages);
+ Assert.assertEquals(485, languages.size());
}
@Test