2121import static com .google .code .beanmatchers .BeanMatchers .hasValidBeanConstructor ;
2222import static com .google .code .beanmatchers .BeanMatchers .hasValidGettersAndSetters ;
2323import static com .imsweb .seerapi .client .glossary .Glossary .Category .GENERAL ;
24+ import static com .imsweb .seerapi .client .glossary .Glossary .Category .HEMATO ;
2425import static org .junit .jupiter .api .Assertions .assertEquals ;
2526import static org .junit .jupiter .api .Assertions .assertFalse ;
2627import static org .junit .jupiter .api .Assertions .assertNotNull ;
@@ -32,7 +33,7 @@ class GlossaryTest {
3233 private static GlossaryService _GLOSSARY ;
3334
3435 @ BeforeAll
35- public static void setup () {
36+ static void setup () {
3637 _GLOSSARY = new SeerApi .Builder ().connect ().glossary ();
3738 }
3839
@@ -49,7 +50,7 @@ void testGlossaryVersions() throws IOException {
4950 assertEquals (1 , versions .size ());
5051 GlossaryVersion version = versions .get (0 );
5152 assertEquals ("latest" , version .getName ());
52- assertNull (version .getType ()); // type not returned when no permisisons
53+ assertNull (version .getType ()); // type isn't returned when no permisisons
5354 assertNotNull (version .getFirstPublished ());
5455 assertNotNull (version .getCount ());
5556 }
@@ -68,7 +69,7 @@ void testGlossaryById() throws IOException {
6869 assertNull (glossary .getPrimarySite ());
6970
7071 assertNull (glossary .getHistology ());
71- assertTrue (glossary .getDefinition ().startsWith ("An x-ray of the lymphatic system." ));
72+ assertTrue (glossary .getDefinition ().startsWith ("An x-ray or computer image of the lymphatic system." ));
7273 assertNull (glossary .getAlternateName ());
7374 assertNull (glossary .getHistory ());
7475 }
@@ -87,15 +88,15 @@ void testGlossarySearch() throws IOException {
8788 assertEquals (Collections .singletonList (term ), results .getTerms ());
8889
8990 // add the category and verify there are no results
90- results = _GLOSSARY .search ("latest" , search .paramMap (), EnumSet .of (Glossary . Category . SOLID_TUMOR )).execute ().body ();
91+ results = _GLOSSARY .search ("latest" , search .paramMap (), EnumSet .of (GENERAL )).execute ().body ();
9192
9293 assertNotNull (results );
9394 assertEquals (25 , results .getCount ().longValue ());
94- assertEquals ( 0 , results .getTotal ().longValue ());
95- assertNull (results .getResults ());
95+ assertTrue ( results .getTotal ().longValue () > 0 );
96+ assertFalse (results .getResults (). isEmpty ());
9697
9798 // add a second category and verify there are we get the results again
98- results = _GLOSSARY .search ("latest" , search .paramMap (), EnumSet .of (Glossary . Category . SOLID_TUMOR , Glossary .Category .HEMATO )).execute ().body ();
99+ results = _GLOSSARY .search ("latest" , search .paramMap (), EnumSet .of (GENERAL , Glossary .Category .HEMATO )).execute ().body ();
99100
100101 assertNotNull (results );
101102 assertEquals (25 , results .getCount ().longValue ());
@@ -126,19 +127,23 @@ void testGlossarySearchIterate() throws IOException {
126127 search .setOffset (search .getOffset () + results .getResults ().size ());
127128 }
128129
129- assertTrue (total > 100 );
130+ assertTrue (total > 0 );
130131 }
131132
132133 @ Test
133134 void testGlossaryMatch () throws IOException {
134- String text = "This text contains summary stage which should be found. " ;
135+ String text = "white blood cells that produce antibodies " ;
135136
136137 Set <KeywordMatch > matches = _GLOSSARY .match (text , null , true ).execute ().body ();
137138 assertNotNull (matches );
138- assertEquals (1 , matches .size ());
139+ assertEquals (2 , matches .size ());
139140
140141 matches = _GLOSSARY .match (text , EnumSet .of (GENERAL ), true ).execute ().body ();
141142 assertNotNull (matches );
143+ assertEquals (2 , matches .size ());
144+
145+ matches = _GLOSSARY .match (text , EnumSet .of (HEMATO ), true ).execute ().body ();
146+ assertNotNull (matches );
142147 assertEquals (0 , matches .size ());
143148 }
144149
0 commit comments