### Question:
ResourceRegistrar { public static XAResourceProducer get(final String uniqueName) { if (uniqueName != null) { for (ProducerHolder holder : resources) { if (!holder.isInitialized()) continue; if (uniqueName.equals(holder.getUniqueName())) return holder.producer; } } return null; } private  ResourceRegistrar(); static XAResourceProducer get(final String uniqueName); static Set<String> getResourcesUniqueNames(); static void register(XAResourceProducer producer); static void unregister(XAResourceProducer producer); static XAResourceHolder findXAResourceHolder(XAResource xaResource); final static Charset UNIQUE_NAME_CHARSET; }### Answer:
@Test public void testGet() throws Exception { assertSame(producer, ResourceRegistrar.get("xa-rp")); assertNull(ResourceRegistrar.get("non-existing")); assertNull(ResourceRegistrar.get(null)); }
@Test public void testGetDoesNotReturnUninitializedProducers() throws Exception { CountDownLatch border = new CountDownLatch(1); Future future = registerBlockingProducer(createMockProducer("uninitialized"), border); assertNull(ResourceRegistrar.get("uninitialized")); border.countDown(); future.get(); assertNotNull(ResourceRegistrar.get("uninitialized")); }