DataBuilder { @Nonnull public Data build() { addTypeToBrowser(browserBuilders, browserTypes); addPatternToBrowser(browserBuilders, browserPatterns); addPatternToOperatingSystem(operatingSystemBuilders, operatingSystemPatterns); addPatternToDevice(deviceBuilders, devicePatterns); final Map<Integer, OperatingSystem> systems = buildOperatingSystems(operatingSystemBuilders); addOperatingSystemToBrowser(browserBuilders, systems, convertBrowserOsMapping(browserToOperatingSystemMap)); final Set<OperatingSystem> osSet = convertOperatingSystems(systems); osSet.addAll(operatingSystems); final Set<Browser> browserSet = buildBrowsers(browserBuilders); browserSet.addAll(browsers); final Set<Device> deviceSet = buildDevices(deviceBuilders); deviceSet.addAll(devices); final SortedMap<BrowserPattern, Browser> patternToBrowserMap = buildPatternToBrowserMap(browserSet); final SortedMap<OperatingSystemPattern, OperatingSystem> patternToOperatingSystemMap = buildPatternToOperatingSystemMap(osSet); final SortedMap<DevicePattern, Device> patternToDeviceMap = buildPatternToDeviceMap(deviceSet); return new Data(browserSet, browserPatterns, browserTypes, patternToBrowserMap, browserToOperatingSystemMap, osSet, operatingSystemPatterns, patternToOperatingSystemMap, robots, deviceSet, devicePatterns, patternToDeviceMap, version); }  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 = IllegalNullArgumentException.class) public void build_withoutData() { new DataBuilder().build(); }