ThingTypeBuilder { public ThingType build() { if (bindingId == null || bindingId.isBlank()) { throw new IllegalArgumentException("The bindingId must neither be null nor empty."); } if (thingTypeId == null || thingTypeId.isBlank()) { throw new IllegalArgumentException("The thingTypeId must neither be null nor empty."); } if (label == null || label.isBlank()) { throw new IllegalArgumentException("The label must neither be null nor empty."); } return new ThingType(new ThingTypeUID(bindingId, thingTypeId), supportedBridgeTypeUIDs, label, description, category, listed, representationProperty, channelDefinitions, channelGroupDefinitions, properties, configDescriptionURI, extensibleChannelTypeIds); } private  ThingTypeBuilder(String bindingId, String thingTypeId, String label); private  ThingTypeBuilder(ThingType thingType); static ThingTypeBuilder instance(String bindingId, String thingTypeId, String label); static ThingTypeBuilder instance(ThingTypeUID thingTypeUID, String label); static ThingTypeBuilder instance(ThingType thingType); ThingType build(); BridgeType buildBridge(); ThingTypeBuilder withLabel(String label); ThingTypeBuilder withDescription(String description); ThingTypeBuilder withCategory(String category); ThingTypeBuilder isListed(boolean listed); ThingTypeBuilder withRepresentationProperty(String representationProperty); ThingTypeBuilder withChannelDefinitions(List<ChannelDefinition> channelDefinitions); ThingTypeBuilder withChannelGroupDefinitions(List<ChannelGroupDefinition> channelGroupDefinitions); ThingTypeBuilder withProperties(Map<String, String> properties); ThingTypeBuilder withConfigDescriptionURI(URI configDescriptionURI); ThingTypeBuilder withExtensibleChannelTypeIds(List<String> extensibleChannelTypeIds); ThingTypeBuilder withSupportedBridgeTypeUIDs(List<String> supportedBridgeTypeUIDs);  }
@Test public void withLabelAndThingTypeIdAndBindingIDShouldCreateThingType() { ThingType thingType = builder.build(); assertThat(thingType.getBindingId(), is(BINDING_ID)); assertThat(thingType.getUID().getBindingId(), is(BINDING_ID)); assertThat(thingType.getUID().getId(), is(THING_TYPE_ID)); assertThat(thingType.getLabel(), is(LABEL)); }