ThingBuilder { public ThingBuilder withoutChannel(ChannelUID channelUID) { Iterator<Channel> iterator = channels.iterator(); while (iterator.hasNext()) { if (iterator.next().getUID().equals(channelUID)) { iterator.remove(); break; } } return this; } protected  ThingBuilder(ThingTypeUID thingTypeUID, ThingUID thingUID); static ThingBuilder create(ThingTypeUID thingTypeUID, String thingId); static ThingBuilder create(ThingTypeUID thingTypeUID, ThingUID thingUID); Thing build(); ThingBuilder withLabel(@Nullable String label); ThingBuilder withChannel(Channel channel); ThingBuilder withChannels(Channel... channels); ThingBuilder withChannels(List<Channel> channels); ThingBuilder withoutChannel(ChannelUID channelUID); ThingBuilder withoutChannels(Channel... channels); ThingBuilder withoutChannels(List<Channel> channels); ThingBuilder withConfiguration(Configuration configuration); ThingBuilder withBridge(@Nullable ThingUID bridgeUID); ThingBuilder withProperties(Map<String, String> properties); ThingBuilder withLocation(@Nullable String location);  }
@Test public void testWithoutChannel() { thingBuilder.withChannels( ChannelBuilder.create(new ChannelUID(THING_UID, "channel1")).build(), ChannelBuilder.create(new ChannelUID(THING_UID, "channel2")).build()); thingBuilder.withoutChannel(new ChannelUID(THING_UID, "channel1")); Thing thing = thingBuilder.build(); assertThat(thing.getChannels(), hasSize(1)); assertThat(thing.getChannels().get(0).getUID().getId(), is(equalTo("channel2"))); }