File tree Expand file tree Collapse file tree
main/java/com/imsweb/seerapi/client/ndc
test/java/com/imsweb/seerapi/client/ndc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ public class NdcSearch {
1212
1313 private String _query ;
1414 private Category _category ;
15+ private Boolean _hasSeerInfo ;
1516 private Boolean _includeRemoved ;
1617 private String _addedSince ;
1718 private String _modifiedSince ;
@@ -36,6 +37,14 @@ public void setCategory(Category category) {
3637 _category = category ;
3738 }
3839
40+ public Boolean getHasSeerInfo () {
41+ return _hasSeerInfo ;
42+ }
43+
44+ public void setHasSeerInfo (Boolean hasSeerInfo ) {
45+ _hasSeerInfo = hasSeerInfo ;
46+ }
47+
3948 public Boolean getIncludeRemoved () {
4049 return _includeRemoved ;
4150 }
@@ -103,6 +112,8 @@ public Map<String, String> paramMap() {
103112 params .put ("q" , getQuery ());
104113 if (getCategory () != null )
105114 params .put ("category" , getCategory ().toString ());
115+ if (getHasSeerInfo () != null )
116+ params .put ("has_seer_info" , getHasSeerInfo ().toString ());
106117 if (getIncludeRemoved () != null )
107118 params .put ("include_removed" , getIncludeRemoved () ? "true" : "false" );
108119 if (getAddedSince () != null )
Original file line number Diff line number Diff line change @@ -116,4 +116,29 @@ public void testNdcSearchByCategory() throws IOException {
116116 assertThat (product .getSeerInfo ().getCategories ()).contains (Category .CHEMOTHERAPY );
117117 }
118118
119+ @ Test
120+ public void testNdcHasSeerInfo () throws IOException {
121+ NdcSearch search = new NdcSearch ();
122+ search .setIncludeRemoved (true );
123+
124+ // get count of all drugs
125+ Response <List <NdcProduct >> response = _NDC .search (search .paramMap ()).execute ();
126+ Integer totalCount = Integer .parseInt (response .headers ().get ("X-Total-Count" ));
127+ assertThat (totalCount ).isGreaterThan (0 );
128+
129+ // get count of seer-info drugs
130+ search .setHasSeerInfo (true );
131+ response = _NDC .search (search .paramMap ()).execute ();
132+ Integer withCount = Integer .parseInt (response .headers ().get ("X-Total-Count" ));
133+ assertThat (withCount ).isGreaterThan (0 ).isLessThan (totalCount );
134+
135+ // get count of non seer-info drugs
136+ search .setHasSeerInfo (false );
137+ response = _NDC .search (search .paramMap ()).execute ();
138+ Integer withoutCount = Integer .parseInt (response .headers ().get ("X-Total-Count" ));
139+ assertThat (withCount ).isGreaterThan (0 ).isLessThan (totalCount );
140+
141+ assertThat (totalCount ).isEqualTo (withCount + withoutCount );
142+ }
143+
119144}
You can’t perform that action at this time.
0 commit comments