@Test public void testDistinctFactories() throws Exception { DefaultDeploymentCreator creator = new DefaultDeploymentCreator( new MockDefaultDeploymentFactory("war", 0), new MockDefaultDeploymentFactory("jar", 0) ); DefaultDeploymentFactory jarFactory = creator.getFactory("jar"); assertThat(jarFactory).isNotNull(); assertThat(jarFactory.getType()).isEqualTo("jar"); DefaultDeploymentFactory warFactory = creator.getFactory("war"); assertThat(warFactory).isNotNull(); assertThat(warFactory.getType()).isEqualTo("war"); DefaultDeploymentFactory fooFactory = creator.getFactory("foo"); assertThat(fooFactory).isNull(); }
DefaultDeploymentFactory getFactory(String type) { return this.factories.get(type); }
DefaultDeploymentCreator { DefaultDeploymentFactory getFactory(String type) { return this.factories.get(type); } }
DefaultDeploymentCreator { DefaultDeploymentFactory getFactory(String type) { return this.factories.get(type); } @Inject  DefaultDeploymentCreator(@Any Instance<DefaultDeploymentFactory> factories);  DefaultDeploymentCreator(DefaultDeploymentFactory... factories);  DefaultDeploymentCreator(Iterable<DefaultDeploymentFactory> factories); }
DefaultDeploymentCreator { DefaultDeploymentFactory getFactory(String type) { return this.factories.get(type); } @Inject  DefaultDeploymentCreator(@Any Instance<DefaultDeploymentFactory> factories);  DefaultDeploymentCreator(DefaultDeploymentFactory... factories);  DefaultDeploymentCreator(Iterable<DefaultDeploymentFactory> factories); Archive<?> createDefaultDeployment(String type); }
DefaultDeploymentCreator { DefaultDeploymentFactory getFactory(String type) { return this.factories.get(type); } @Inject  DefaultDeploymentCreator(@Any Instance<DefaultDeploymentFactory> factories);  DefaultDeploymentCreator(DefaultDeploymentFactory... factories);  DefaultDeploymentCreator(Iterable<DefaultDeploymentFactory> factories); Archive<?> createDefaultDeployment(String type);  }