@Test public void testInit() { List<Marshaller<?>> marshallers = new ArrayList<>(); Arrays.stream(marshallerClasses).forEach(clazz -> { Marshaller marshaller = mock(Marshaller.class); when(marshaller.getType()).thenReturn(clazz); marshallers.add(marshaller); }); when(marshallerInstance.iterator()).thenReturn(marshallers.iterator()); ((VFSMarshallerRegistry) marshallerRegistry).init(); for (int i = 0; i < marshallerClasses.length; i++) { Class clazz = marshallerClasses[i]; Marshaller marshaller = marshallerRegistry.get(clazz); assertNotNull(marshaller); assertEquals(clazz, marshaller.getType()); } }
@PostConstruct public void init() { marshallerInstance.iterator().forEachRemaining(marshaller -> { logger.debug("Registering marshaller into VFSMarshallerRegistry, marshaller: " + marshaller); register(marshaller.getType(), marshaller); }); }
VFSMarshallerRegistry extends BaseMarshallerRegistry { @PostConstruct public void init() { marshallerInstance.iterator().forEachRemaining(marshaller -> { logger.debug("Registering marshaller into VFSMarshallerRegistry, marshaller: " + marshaller); register(marshaller.getType(), marshaller); }); } }
VFSMarshallerRegistry extends BaseMarshallerRegistry { @PostConstruct public void init() { marshallerInstance.iterator().forEachRemaining(marshaller -> { logger.debug("Registering marshaller into VFSMarshallerRegistry, marshaller: " + marshaller); register(marshaller.getType(), marshaller); }); } VFSMarshallerRegistry(); @Inject  VFSMarshallerRegistry(final @Any Instance<Marshaller<?>> marshallerInstance); }
VFSMarshallerRegistry extends BaseMarshallerRegistry { @PostConstruct public void init() { marshallerInstance.iterator().forEachRemaining(marshaller -> { logger.debug("Registering marshaller into VFSMarshallerRegistry, marshaller: " + marshaller); register(marshaller.getType(), marshaller); }); } VFSMarshallerRegistry(); @Inject  VFSMarshallerRegistry(final @Any Instance<Marshaller<?>> marshallerInstance); @PostConstruct void init(); }
VFSMarshallerRegistry extends BaseMarshallerRegistry { @PostConstruct public void init() { marshallerInstance.iterator().forEachRemaining(marshaller -> { logger.debug("Registering marshaller into VFSMarshallerRegistry, marshaller: " + marshaller); register(marshaller.getType(), marshaller); }); } VFSMarshallerRegistry(); @Inject  VFSMarshallerRegistry(final @Any Instance<Marshaller<?>> marshallerInstance); @PostConstruct void init();  }