### Question:
ServiceReferenceImpl implements ServiceReference<T> { public Object getReference() { if (usesFactory) { return ServiceFactory.class.cast(reference).getService(bundle, registration); } return reference; } ServiceReferenceImpl(final Dictionary<String, Object> properties, final Bundle bundle, final Object reference); boolean hasFactory(); ServiceRegistrationImpl getRegistration(); Object getReference(); @Override Object getProperty(final String key); @Override String[] getPropertyKeys(); @Override Bundle getBundle(); @Override Bundle[] getUsingBundles(); @Override boolean isAssignableTo(final Bundle bundle, final String className); @Override int compareTo(final Object reference); @Override Dictionary<String, Object> getProperties(); boolean unget(); ServiceFactory<?> getFactory(); @Override String toString();  }### Answer:
@Test void singleton() { final ServiceReferenceImpl<Object> ref = new ServiceReferenceImpl<>(new Hashtable<>(), null, new SomeService()); assertEquals(ref.getReference(), ref.getReference()); }
@Test void prototype() { final ServiceReferenceImpl<Object> ref = new ServiceReferenceImpl<>(new Hashtable<>(), null, new PrototypeServiceFactory<SomeService>() { @Override public SomeService getService(final Bundle bundle, final ServiceRegistration<SomeService> registration) { return new SomeService(); } @Override public void ungetService(final Bundle bundle, final ServiceRegistration<SomeService> registration, final SomeService service) { } }); assertNotSame(ref.getReference(), ref.getReference()); }