@Test public void testServiceFactoryWithNullServiceName() throws IOException { ClusterControllerFactory factory = new ClusterControllerFactory(); ClusterController controller = factory.create(null); assertThat(controller, instanceOf(ClusterController.class)); }
public ClusterController create(String serviceName) { if (serviceName == null) { return new ClusterController(); } for (ClusterController controller : serviceLoader) { if (controller.getName().equals(serviceName)) { return controller; } } return null; }
ClusterControllerFactory { public ClusterController create(String serviceName) { if (serviceName == null) { return new ClusterController(); } for (ClusterController controller : serviceLoader) { if (controller.getName().equals(serviceName)) { return controller; } } return null; } }
ClusterControllerFactory { public ClusterController create(String serviceName) { if (serviceName == null) { return new ClusterController(); } for (ClusterController controller : serviceLoader) { if (controller.getName().equals(serviceName)) { return controller; } } return null; }  }
ClusterControllerFactory { public ClusterController create(String serviceName) { if (serviceName == null) { return new ClusterController(); } for (ClusterController controller : serviceLoader) { if (controller.getName().equals(serviceName)) { return controller; } } return null; }  ClusterController create(String serviceName); Set<String> availableServices(); }
ClusterControllerFactory { public ClusterController create(String serviceName) { if (serviceName == null) { return new ClusterController(); } for (ClusterController controller : serviceLoader) { if (controller.getName().equals(serviceName)) { return controller; } } return null; }  ClusterController create(String serviceName); Set<String> availableServices();  }