### Question:
SW360Assert { public static <T> void assertIds(Collection<T> collection, Function<? super T, Boolean> idSetExtractor) throws SW360Exception { if (!collection.stream().allMatch(el -> { return idSetExtractor.apply(el); })) { throw fail("ID already set, cannot add to database!"); } } private  SW360Assert(); static T assertNotNull(T object); static T assertNotNull(T object, String messageFormat, Object... args); static T assertNull(T object); static T assertNull(T object, String messageFormat, Object... args); static void assertId(String id); static void assertIds(Collection<T> collection, Function<? super T, Boolean> idSetExtractor); static User assertUser(User user); static void assertNotEmpty(String string); static void assertNotEmpty(String string, String message); static T assertNotEmpty(T collection); static T assertNotEmpty(T collection, String message); static void assertIdUnset(String id); static void assertIdsUnset(Collection<T> collection, Function<? super T, Boolean> idSetExtractor); static void assertEmpty(String string); static void assertEmpty(String string, String message); static void failIf(boolean condition, String messageFormat, Object... args); static SW360Exception fail(String messageFormat, Object... args); static SW360Exception fail(int errorCode, String messageFormat, Object... args); static SW360Exception fail(Throwable t, String messageFormat, Object... args); static void assertEquals(Object expected, Object actual); static void assertEquals(Object expected, Object actual, String message); static void assertValidUrl(String url); static void assertTrue(boolean condition);  }### Answer:
@Test public void testAssertIdsSuccess() throws SW360Exception { Set<ObjectWithId> set = Sets.newHashSet(new ObjectWithId(true), new ObjectWithId(true)); SW360Assert.assertIds(set, o -> o.isSet()); }