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