@@ -285,6 +285,46 @@ public void testRecommendations() throws IOException {
285285    assertTrue (source .getDependencies ().stream ().noneMatch (d  -> d .getRef ().name ().equals ("ac" )));
286286  }
287287
288+   @ Test 
289+   public  void  testRecommendationsWithoutIssues () throws  IOException  {
290+     PackageRef  abRecommendation  = new  PackageRef ("pkg:npm/ab@1-redhat-00001" );
291+     PackageRef  acRecommendation  = new  PackageRef ("pkg:npm/ac@1-redhat-00006" );
292+     Map <PackageRef , IndexedRecommendation > recommendations  =
293+         Map .of (
294+             new  PackageRef ("pkg:npm/ab@1" ),
295+             new  IndexedRecommendation (abRecommendation , Collections .emptyMap ()),
296+             acRecommendation , // recommend the same should be ignored 
297+             new  IndexedRecommendation (acRecommendation , Collections .emptyMap ()));
298+ 
299+     Map <String , List <Issue >> issues  = Collections .emptyMap ();
300+ 
301+     ProviderResponseHandler  handler  = new  TestResponseHandler ();
302+ 
303+     var  report  =
304+         handler .buildReport (
305+             new  ProviderResponse (issues , null ),
306+             buildTree (),
307+             null ,
308+             new  TrustedContentResponse (recommendations , null ));
309+ 
310+     assertNotNull (report );
311+     assertNotNull (report .getSources ());
312+     Source  source  = report .getSources ().get (TEST_PROVIDER );
313+     assertNotNull (source );
314+ 
315+     assertEquals (1 , source .getSummary ().getRecommendations ());
316+     assertEquals (1 , source .getDependencies ().size ());
317+ 
318+     assertTrue (
319+         source .getDependencies ().stream ()
320+             .anyMatch (
321+                 d  ->
322+                     d .getRef ().name ().equals ("ab" )
323+                         && d .getRecommendation ().equals (abRecommendation )));
324+     assertTrue (source .getDependencies ().stream ().noneMatch (d  -> d .getRef ().name ().equals ("aa" )));
325+     assertTrue (source .getDependencies ().stream ().noneMatch (d  -> d .getRef ().name ().equals ("ac" )));
326+   }
327+ 
288328  @ Test 
289329  public  void  testRemediations () throws  IOException  {
290330    PackageRef  abRemediation  = new  PackageRef ("pkg:npm/ab@1-redhat-00008" );
0 commit comments