### Question:
ClientResolver { public static ClientFactory getClientFactory(String persistenceUnit, Map<String, Object> puProperties,final KunderaMetadata kunderaMetadata) { ClientFactory clientFactory = instantiateClientFactory(persistenceUnit, puProperties, kunderaMetadata); clientFactories.put(persistenceUnit, clientFactory); return clientFactory; }  static ClientFactory getClientFactory(String persistenceUnit, Map<String, Object> puProperties,final KunderaMetadata kunderaMetadata); static ClientFactory getClientFactory(String pu);  }### Answer:
@Test public void test() { EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); ClientResolver.getClientFactory(persistenceUnit, null, ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance()); ClientFactory clientFactory = ClientResolver.getClientFactory(persistenceUnit); Assert.assertNotNull(clientFactory); Assert.assertTrue(clientFactory.getClass().isAssignableFrom(CoreTestClientFactory.class)); }
@Test public void testInvalidPU() { EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); ClientResolver.getClientFactory(persistenceUnit, null, ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance()); try { ClientResolver.getClientFactory("metadatatest"); Assert.fail("Should have gone to catch block!"); } catch (ClientResolverException crex) { Assert.assertEquals("Client Factory Not Configured For Specified Client Type.", crex.getMessage()); } }