DataBuilder { @Nonnull public DataBuilder appendOperatingSystemBuilder(@Nonnull final OperatingSystem.Builder operatingSystemBuilder) { Check.notNull(operatingSystemBuilder, "operatingSystemBuilder"); Check.notNegative(operatingSystemBuilder.getId(), "operatingSystemBuilder.getId()"); Check.stateIsTrue(!operatingSystemBuilders.containsKey(operatingSystemBuilder.getId()), "Operating system builder with ID '%s' already exists.", operatingSystemBuilder.getId()); final OperatingSystem.Builder builder = operatingSystemBuilder.copy(); operatingSystemBuilders.put(builder.getId(), builder); return this; }  DataBuilder appendBrowser(@Nonnull final Browser browser); @Nonnull DataBuilder appendBrowserBuilder(@Nonnull final Browser.Builder browserBuilder); @Nonnull DataBuilder appendBrowserOperatingSystemMapping(@Nonnull final BrowserOperatingSystemMapping browserOsMapping); @Nonnull DataBuilder appendBrowserPattern(@Nonnull final BrowserPattern pattern); @Nonnull DataBuilder appendBrowserType(@Nonnull final BrowserType type); DataBuilder appendDevice(@Nonnull final Device device); @Nonnull DataBuilder appendDeviceBuilder(@Nonnull final Device.Builder deviceBuilder); @Nonnull DataBuilder appendDevicePattern(@Nonnull final DevicePattern pattern); @Nonnull DataBuilder appendOperatingSystem(@Nonnull final OperatingSystem operatingSystem); @Nonnull DataBuilder appendOperatingSystemBuilder(@Nonnull final OperatingSystem.Builder operatingSystemBuilder); @Nonnull DataBuilder appendOperatingSystemPattern(@Nonnull final OperatingSystemPattern pattern); @Nonnull DataBuilder appendRobot(@Nonnull final Robot robot); @Nonnull Data build(); @Nonnull DataBuilder setVersion(@Nonnull final String version);  }
@Test(expected = IllegalStateOfArgumentException.class) public void appendOperatingSystemBuilder_addSameOneMoreTime() { final OperatingSystem.Builder builder = new OperatingSystem.Builder().setId("1").setFamily("f1").setIcon("i1").setInfoUrl("iu1") .setProducer("p1").setProducerUrl("pu1").setUrl("u1"); final DataBuilder b = new DataBuilder(); assertThat(b.appendOperatingSystemBuilder(builder)).isSameAs(b); b.appendOperatingSystemBuilder(builder); }
@Test(expected = IllegalNegativeArgumentException.class) public void appendOperatingSystemBuilder_id_toSmall() { final DataBuilder b = new DataBuilder(); b.appendOperatingSystemBuilder(new OperatingSystem.Builder()); }
@Test(expected = IllegalNullArgumentException.class) public void appendOperatingSystemBuilder_null() { final DataBuilder b = new DataBuilder(); b.appendOperatingSystemBuilder(null); }