Subjects implements SerializableMessage { public static Subjects from(Set<String> subjects) { Preconditions.checkNotNull(subjects, "'subjects' is mandatory"); return new Subjects(subjects); } private  Subjects(Set<String> subjects); static Subjects from(Set<String> subjects); @JsonValue Set<String> getSubjects(); @Override String serialize();  }
@Test void fromShouldThrowWhenSetIsNull() { assertThatThrownBy(() -> Subjects.from(null)) .isInstanceOf(NullPointerException.class) .hasMessage("'subjects' is mandatory"); }