### Question:
FreeIpaChecks { public static void checkUserNotProtected(String user, Supplier<String> errorMessage) throws FreeIpaClientException { if (IPA_PROTECTED_USERS.contains(user)) { 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 checkUserNotProtectedPasses() throws FreeIpaClientException { String errMessage = "user protected"; FreeIpaChecks.checkUserNotProtected("clark", () -> errMessage); }
@Test void checkUserNotProtectedThrows() { String errMessage = "user protected"; for (String user : FreeIpaChecks.IPA_PROTECTED_USERS) { Exception e = assertThrows(FreeIpaClientException.class, () -> FreeIpaChecks.checkUserNotProtected(user, () -> errMessage) ); assertEquals(errMessage, e.getMessage()); } }