Project

General

Profile

« Previous | Next » 

Revision e1090d5d

Added by Andreas Müller over 8 years ago

Fully remove old vocabulary.byClass methods #3843

View differences:

cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/TermVocabularyDaoImplTest.java
31 31
import eu.etaxonomy.cdm.model.common.Representation;
32 32
import eu.etaxonomy.cdm.model.common.TermType;
33 33
import eu.etaxonomy.cdm.model.common.TermVocabulary;
34
import eu.etaxonomy.cdm.model.location.Country;
35
import eu.etaxonomy.cdm.model.location.NamedArea;
36
import eu.etaxonomy.cdm.model.name.Rank;
37 34
import eu.etaxonomy.cdm.persistence.dao.common.ITermVocabularyDao;
38 35
import eu.etaxonomy.cdm.test.integration.CdmIntegrationTest;
39 36

  
......
90 87
        assertEquals("There should be 2 vocabularies, the empty one and the one that has a language term in", 2, languageVocabulariesAndEmpty.size());
91 88
    }
92 89

  
93

  
94
	@Test
95
	public void testListVocabularyByClass() {
96
		//test class with no subclasses
97
		List<TermVocabulary<? extends Rank>> rankVocabularies = dao.listByTermClass(Rank.class, false, false, null, null, null, null);
98
		assertFalse("There should be at least one vocabulary containing terms of class Rank",rankVocabularies.isEmpty());
99
		assertEquals("There should be only one vocabulary containing terms of class Rank",1,rankVocabularies.size());
100

  
101
		rankVocabularies = dao.listByTermClass(Rank.class, true, false, null, null, null, null);
102
		assertFalse("There should be at least one vocabulary containing terms of class Rank",rankVocabularies.isEmpty());
103
		assertEquals("There should be only one vocabulary containing terms of class Rank",1,rankVocabularies.size());
104

  
105
		//with subclasses
106
		List<TermVocabulary<? extends NamedArea>> namedAreaVocabularies = dao.listByTermClass(NamedArea.class, true, false, null, null, null, null);
107
		int subclassedSize = namedAreaVocabularies.size();
108
		assertEquals("There should be 3 vocabularies (TdwgAreas, Continents, WaterbodyOrCountries)", 4, subclassedSize);
109

  
110
		List<TermVocabulary<? extends NamedArea>> namedAreaOnlyVocabularies = dao.listByTermClass(NamedArea.class, false, false, null, null, null, null);
111
		List<TermVocabulary<? extends Country>> countryVocabularies = dao.listByTermClass(Country.class, false, false, null, null, null, null);
112
		int sumOfSingleSizes = namedAreaOnlyVocabularies.size() + countryVocabularies.size();
113
		assertEquals("number of NamedArea and subclasses should be same as sum of all single vocabularies", subclassedSize, sumOfSingleSizes);
114
	}
115

  
116
	@Test
117
	@DataSet("TermVocabularyDaoImplTest.testListVocabularyEmpty.xml")
118
	public void testListVocabularyByClassEmpty() {
119
		//test include empty
120
		List<TermVocabulary<? extends NamedArea>> namedAreaVocabulariesAndEmpty = dao.listByTermClass(NamedArea.class, true, true, null, null, null, null);
121
		assertEquals("There should be 1 vocabulary (the empty one)", 1, namedAreaVocabulariesAndEmpty.size());
122

  
123
		List<TermVocabulary<? extends Language>> languageVocabulariesAndEmpty = dao.listByTermClass(Language.class, true, true, null, null, null, null);
124
		assertEquals("There should be 2 vocabularies, the empty one and the one that has a language term in", 2, languageVocabulariesAndEmpty.size());
125
	}
126
//
127
//	@Test
128
//	@DataSet("TermVocabularyDaoImplTest.testListVocabularyEmpty.xml")
129
//	public void testListVocabularyEmpty() {
130
//		//test class with no subclasses
131
//		List<TermVocabulary> emptyVocs = dao.listEmpty(null, null, null, null);
132
//		assertFalse("There should be at least one vocabulary containing no terms",emptyVocs.isEmpty());
133
//		assertEquals("There should be only one vocabulary containing terms of class Rank",1,emptyVocs.size());
134
//		UUID uuidEmptyVoc = UUID.fromString("f253962f-d787-4b16-b2d2-e645da73ae4f");
135
//		assertEquals("The empty vocabulary should be the one defined", uuidEmptyVoc, emptyVocs.get(0).getUuid());
136
//	}
137

  
138 90
	@Test
139 91
	public void testMissingTermUuids() {
140 92
		Set<UUID> uuidSet = new HashSet<UUID>();

Also available in: Unified diff