@Test public void shouldReturnDefaultCrnsWithLegacy() { CrnsByCategory result = underTest.getDefaultResourceCrns(List.of(DEFAULT_CRN, OTHER_CRN)); assertEquals(List.of(DEFAULT_CRN), result.getDefaultResourceCrns()); assertEquals(List.of(OTHER_CRN), result.getNotDefaultResourceCrns()); }
@Override public CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns) { Map<Boolean, List<String>> byDefault = resourceCrns.stream().collect(Collectors.partitioningBy(this::isDefault)); return CrnsByCategory.newBuilder() .defaultResourceCrns(byDefault.getOrDefault(true, List.of())) .notDefaultResourceCrns(byDefault.getOrDefault(false, List.of())) .build(); }
DefaultImageChecker implements DefaultResourceChecker { @Override public CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns) { Map<Boolean, List<String>> byDefault = resourceCrns.stream().collect(Collectors.partitioningBy(this::isDefault)); return CrnsByCategory.newBuilder() .defaultResourceCrns(byDefault.getOrDefault(true, List.of())) .notDefaultResourceCrns(byDefault.getOrDefault(false, List.of())) .build(); } }
DefaultImageChecker implements DefaultResourceChecker { @Override public CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns) { Map<Boolean, List<String>> byDefault = resourceCrns.stream().collect(Collectors.partitioningBy(this::isDefault)); return CrnsByCategory.newBuilder() .defaultResourceCrns(byDefault.getOrDefault(true, List.of())) .notDefaultResourceCrns(byDefault.getOrDefault(false, List.of())) .build(); } @Inject  DefaultImageChecker(ImageCatalogService imageCatalogService); }
DefaultImageChecker implements DefaultResourceChecker { @Override public CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns) { Map<Boolean, List<String>> byDefault = resourceCrns.stream().collect(Collectors.partitioningBy(this::isDefault)); return CrnsByCategory.newBuilder() .defaultResourceCrns(byDefault.getOrDefault(true, List.of())) .notDefaultResourceCrns(byDefault.getOrDefault(false, List.of())) .build(); } @Inject  DefaultImageChecker(ImageCatalogService imageCatalogService); @Override AuthorizationResourceType getResourceType(); @Override boolean isDefault(String resourceCrn); @Override CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns); @Override boolean isAllowedAction(AuthorizationResourceAction action); }
DefaultImageChecker implements DefaultResourceChecker { @Override public CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns) { Map<Boolean, List<String>> byDefault = resourceCrns.stream().collect(Collectors.partitioningBy(this::isDefault)); return CrnsByCategory.newBuilder() .defaultResourceCrns(byDefault.getOrDefault(true, List.of())) .notDefaultResourceCrns(byDefault.getOrDefault(false, List.of())) .build(); } @Inject  DefaultImageChecker(ImageCatalogService imageCatalogService); @Override AuthorizationResourceType getResourceType(); @Override boolean isDefault(String resourceCrn); @Override CrnsByCategory getDefaultResourceCrns(Collection<String> resourceCrns); @Override boolean isAllowedAction(AuthorizationResourceAction action);  }