InstanceIdentifierSupplier implements Supplier<String> { public static InstanceIdentifierSupplier getInstance() { InstanceIdentifierSupplier result = instance; if (null == result) { result = new InstanceIdentifierSupplier(); instance = result; } return result; } private  InstanceIdentifierSupplier(); static InstanceIdentifierSupplier getInstance(); @Override String get();  }
@Test public void getInstanceReturnsSingleton() { final InstanceIdentifierSupplier firstObtainedInstance = InstanceIdentifierSupplier.getInstance(); final InstanceIdentifierSupplier secondObtainedInstance = InstanceIdentifierSupplier.getInstance(); assertThat(firstObtainedInstance).isSameAs(secondObtainedInstance); }