@@ -37,10 +37,35 @@ public void getRecommendationsShouldReturnAResultWithItemIdAndVariationId() thro
3737 request .setItemIds (Arrays .asList ("power_drill" ));
3838 request .setVariationId ("power_drill_variation" );
3939 RecommendationsResponse response = constructor .recommendations (request , userInfo );
40- assertTrue ("recommendation results exist" , response .getResponse ().getResults ().size () >= 0 );
40+ assertTrue ("recommendation results exist" , response .getResponse ().getResults ().size () > 0 );
4141 assertTrue ("recommendation result id exists" , response .getResultId () != null );
4242 }
4343
44+ @ Test
45+ public void getRecommendationsShouldErrorWithVariationIdAndNoItemIds () throws Exception {
46+ ConstructorIO constructor = new ConstructorIO ("" , apiKey , true , null );
47+ UserInfo userInfo = new UserInfo (3 , "c62a-2a09-faie" );
48+ RecommendationsRequest request = new RecommendationsRequest ("item_page_1" );
49+ request .setVariationId ("power_drill_variation" );
50+
51+ thrown .expect (ConstructorException .class );
52+ thrown .expectMessage ("variationId requires exactly one itemId to be specified" );
53+ constructor .recommendations (request , userInfo );
54+ }
55+
56+ @ Test
57+ public void getRecommendationsShouldErrorWithVariationIdAndMultipleItemIds () throws Exception {
58+ ConstructorIO constructor = new ConstructorIO ("" , apiKey , true , null );
59+ UserInfo userInfo = new UserInfo (3 , "c62a-2a09-faie" );
60+ RecommendationsRequest request = new RecommendationsRequest ("item_page_1" );
61+ request .setItemIds (Arrays .asList ("power_drill" , "drill" ));
62+ request .setVariationId ("power_drill_variation" );
63+
64+ thrown .expect (ConstructorException .class );
65+ thrown .expectMessage ("variationId requires exactly one itemId to be specified" );
66+ constructor .recommendations (request , userInfo );
67+ }
68+
4469 @ Test
4570 public void getRecommendationsShouldReturnAResultWithMultipleItemIds () throws Exception {
4671 ConstructorIO constructor = new ConstructorIO ("" , apiKey , true , null );
0 commit comments