@Test public void testCreateNullStructure() { NullPointerException e = assertThrows(NullPointerException.class, () -> { RecordFactory.create("name", null); }); assertThat(e.getMessage()).isEqualTo("Structure must not be null"); }
public static Record create(final String name, final Structure structure) { if (name == null) throw new NullPointerException("Name must not be null"); if (structure == null) throw new NullPointerException("Structure must not be null"); return RECORD_FACTORY.createRootRecord(name, structure); }
RecordFactory { public static Record create(final String name, final Structure structure) { if (name == null) throw new NullPointerException("Name must not be null"); if (structure == null) throw new NullPointerException("Structure must not be null"); return RECORD_FACTORY.createRootRecord(name, structure); } }
RecordFactory { public static Record create(final String name, final Structure structure) { if (name == null) throw new NullPointerException("Name must not be null"); if (structure == null) throw new NullPointerException("Structure must not be null"); return RECORD_FACTORY.createRootRecord(name, structure); }  }
RecordFactory { public static Record create(final String name, final Structure structure) { if (name == null) throw new NullPointerException("Name must not be null"); if (structure == null) throw new NullPointerException("Structure must not be null"); return RECORD_FACTORY.createRootRecord(name, structure); }  static Record create(final String name, final Structure structure); }
RecordFactory { public static Record create(final String name, final Structure structure) { if (name == null) throw new NullPointerException("Name must not be null"); if (structure == null) throw new NullPointerException("Structure must not be null"); return RECORD_FACTORY.createRootRecord(name, structure); }  static Record create(final String name, final Structure structure);  }