ThingUID extends UID { public String getId() { List<String> segments = getAllSegments(); return segments.get(segments.size() - 1); } ThingUID();  ThingUID(ThingTypeUID thingTypeUID, String id);  ThingUID(ThingTypeUID thingTypeUID, ThingUID bridgeUID, String id);  ThingUID(ThingTypeUID thingTypeUID, String id, String... bridgeIds);  ThingUID(String bindingId, String id);  ThingUID(String bindingId, ThingUID bridgeUID, String id);  ThingUID(String bindingId, String thingTypeId, String id);  ThingUID(String thingUID);  ThingUID(String... segments); List<String> getBridgeIds(); String getId();  }
@Test public void testThreeSegments() { ThingTypeUID thingType = new ThingTypeUID("fake", "type"); ThingUID subject = new ThingUID(thingType, "thing"); assertEquals("fake", subject.getBindingId()); assertEquals("thing", subject.getId()); assertThat(subject.getAllSegments(), hasSize(3)); assertEquals("fake:type:thing", subject.getAsString()); }
@Test public void testTwoSegments() { ThingUID subject = new ThingUID("fake", "thing"); assertEquals("fake", subject.getBindingId()); assertEquals("thing", subject.getId()); assertThat(subject.getAllSegments(), hasSize(3)); assertEquals("fake::thing", subject.getAsString()); }