MessageStoreUtils { public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>> M buildIfNotNull(B builder) { if (builder == null) { return null; } return builder.build(); }  static List<M> buildAll(Collection<B> builders); @SuppressWarnings("unchecked") static List<B> mutateAll(Collection<M> messages); static M buildIfNotNull(B builder); @SuppressWarnings("unchecked") static B mutateIfNotNull(M message);  }
@Test public void testBuildIfNotNull() { assertThat((PMessage) buildIfNotNull(null), is(nullValue())); }