### Question:
OperationFactory { static Set<Permission> toOperationSet(Set<String> permissionNames) { return permissionNames .stream() .map(String::trim) .map(Permission::valueOf) .collect(Collectors.toCollection(() -> EnumSet.noneOf(Permission.class))); } private  OperationFactory();   }### Answer:
@Test public void stringSetToEnumSet() { Set<String> stringSet = Sets.newHashSet(Arrays.asList("SELECT", "MODIFY")); Set<Permission> permissionSet = OperationFactory.toOperationSet(stringSet); assertThat(permissionSet).containsExactly(Permission.SELECT, Permission.MODIFY); }
@Test public void emptyStringSetToEnumSet() { Set<String> stringSet = Collections.emptySet(); Set<Permission> permissionSet = OperationFactory.toOperationSet(stringSet); assertThat(permissionSet).isEmpty(); }