### Question:
OSCategoryIn implements Function<Set<String>, Predicate<Template>> { @Override public Predicate<Template> apply(final Set<String> acceptableCategories) { final Map<String, String> categories = categoriesSupplier.get(); final Set<String> acceptableOSTypeIds = Maps.filterValues( Maps.transformValues(Maps.uniqueIndex(osTypesSupplier.get(), new Function<OSType, String>() { @Override public String apply(OSType input) { return input.getId(); } }), new Function<OSType, String>() { @Override public String apply(OSType input) { return categories.get(input.getOSCategoryId()); } }), Predicates.in(acceptableCategories)).keySet(); return new Predicate<Template>() { @Override public boolean apply(Template input) { return Predicates.in(acceptableOSTypeIds).apply(input.getOSTypeId()); } @Override public String toString() { return "OSCategoryIn(" + acceptableCategories + ")"; } }; } @Inject  OSCategoryIn(CloudStackApi client);  OSCategoryIn(Supplier<Map<String, String>> categoriesSupplier, Supplier<Set<OSType>> osTypesSupplier); @Override Predicate<Template> apply(final Set<String> acceptableCategories);  }### Answer:
@Test public void testTemplateInAcceptableCategory() { assertTrue(new OSCategoryIn(client).apply(acceptableCategories).apply( Template.builder().id("1").OSTypeId("10").build() )); verify(client, guestOSClient); }
@Test public void testTemplateNotInAcceptableCategory() { assertFalse(new OSCategoryIn(client).apply(acceptableCategories).apply( Template.builder().id("2").OSTypeId("30").build() )); verify(client, guestOSClient); }