### Question:
FreeIpaChecks { public static void checkGroupNotProtected(String group, Supplier<String> errorMessage) throws FreeIpaClientException { if (IPA_PROTECTED_GROUPS.contains(group)) { throw new FreeIpaClientException(errorMessage.get()); } } private  FreeIpaChecks(); static void checkUserNotProtected(String user, Supplier<String> errorMessage); static void checkGroupNotProtected(String group, Supplier<String> errorMessage); static void checkGroupNotUnmanaged(String group, Supplier<String> errorMessage); static final List<String> IPA_PROTECTED_USERS; static final List<String> IPA_PROTECTED_GROUPS; static final List<String> IPA_UNMANAGED_GROUPS; }### Answer:
@Test void checkGroupNotProtectedPasses() throws FreeIpaClientException { String errMessage = "group protected"; FreeIpaChecks.checkGroupNotProtected("superheroes", () -> errMessage); }
@Test void checkGroupNotProtectedThrows() { String errMessage = "group protected"; for (String group : FreeIpaChecks.IPA_PROTECTED_GROUPS) { Exception e = assertThrows(FreeIpaClientException.class, () -> FreeIpaChecks.checkGroupNotProtected(group, () -> errMessage) ); assertEquals(errMessage, e.getMessage()); } }