@Test public void testClients() { Client omdbApiClient = factory.getClient(ClientType.THE_OMDB_API); Client deanClatworthyClient = factory .getClient(ClientType.DEAN_CLATWORTHY); assertNotNull(omdbApiClient); assertTrue(omdbApiClient instanceof OmdbApiClient); assertNotNull(deanClatworthyClient); assertTrue(deanClatworthyClient instanceof DeanClatworthyClient); assertEquals("http: assertEquals("http: deanClatworthyClient.getEndpoint()); }
public final Client getClient(ClientType type) { if (clients.get(type) == null) { switch (type) { case THE_OMDB_API: clients.put(type, ctx.getBean("omdbApiClient", Client.class)); break; case DEAN_CLATWORTHY: clients.put(type, ctx.getBean("deanClatworthyClient", Client.class)); break; } } return clients.get(type); }
ClientFactory { public final Client getClient(ClientType type) { if (clients.get(type) == null) { switch (type) { case THE_OMDB_API: clients.put(type, ctx.getBean("omdbApiClient", Client.class)); break; case DEAN_CLATWORTHY: clients.put(type, ctx.getBean("deanClatworthyClient", Client.class)); break; } } return clients.get(type); } }
ClientFactory { public final Client getClient(ClientType type) { if (clients.get(type) == null) { switch (type) { case THE_OMDB_API: clients.put(type, ctx.getBean("omdbApiClient", Client.class)); break; case DEAN_CLATWORTHY: clients.put(type, ctx.getBean("deanClatworthyClient", Client.class)); break; } } return clients.get(type); } private  ClientFactory(); }
ClientFactory { public final Client getClient(ClientType type) { if (clients.get(type) == null) { switch (type) { case THE_OMDB_API: clients.put(type, ctx.getBean("omdbApiClient", Client.class)); break; case DEAN_CLATWORTHY: clients.put(type, ctx.getBean("deanClatworthyClient", Client.class)); break; } } return clients.get(type); } private  ClientFactory(); static final ClientFactory getInstance(); final Client getClient(ClientType type); }
ClientFactory { public final Client getClient(ClientType type) { if (clients.get(type) == null) { switch (type) { case THE_OMDB_API: clients.put(type, ctx.getBean("omdbApiClient", Client.class)); break; case DEAN_CLATWORTHY: clients.put(type, ctx.getBean("deanClatworthyClient", Client.class)); break; } } return clients.get(type); } private  ClientFactory(); static final ClientFactory getInstance(); final Client getClient(ClientType type);  }