VisibilityGuard { public Set<TypeName> entityStateTypes(Visibility visibility) { checkNotNull(visibility); Set<TypeName> result = repoAccess().filter(access -> access.visibility.is(visibility)) .map(RepositoryAccess::stateTypeName) .collect(toImmutableSet()); return result; } private  VisibilityGuard(); Set<TypeName> entityStateTypes(Visibility visibility);  }
@Test @DisplayName("obtain repos by visibility") void obtainByVisibility() { Set<TypeName> full = guard.entityStateTypes(Visibility.FULL); assertEquals(1, full.size()); assertTrue(full.contains(TypeName.of(FullAccessAggregate.class))); Set<TypeName> subscribable = guard.entityStateTypes(Visibility.SUBSCRIBE); assertEquals(1, subscribable.size()); assertTrue(subscribable.contains(TypeName.of(SubscribableAggregate.class))); Set<TypeName> hidden = guard.entityStateTypes(Visibility.NONE); assertEquals(1, hidden.size()); assertTrue(hidden.contains(TypeName.of(HiddenAggregate.class))); }