@Test void testSubscribe() { testSubject.subscribe(mockBus); verify(mockBus).subscribe(Long.class.getName(), testSubject); verify(mockBus).subscribe(String.class.getName(), testSubject); verify(mockBus).subscribe(HashSet.class.getName(), testSubject); verify(mockBus).subscribe(ArrayList.class.getName(), testSubject); verify(mockBus).subscribe("almostLong", testSubject); verifyNoMoreInteractions(mockBus); }
public Registration subscribe(CommandBus commandBus) { Collection<Registration> subscriptions = supportedCommandNames().stream().map(supportedCommand -> commandBus.subscribe(supportedCommand, this)) .collect(Collectors.toCollection(ArrayDeque::new)); return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false); }
AnnotationCommandHandlerAdapter implements CommandMessageHandler { public Registration subscribe(CommandBus commandBus) { Collection<Registration> subscriptions = supportedCommandNames().stream().map(supportedCommand -> commandBus.subscribe(supportedCommand, this)) .collect(Collectors.toCollection(ArrayDeque::new)); return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false); } }
AnnotationCommandHandlerAdapter implements CommandMessageHandler { public Registration subscribe(CommandBus commandBus) { Collection<Registration> subscriptions = supportedCommandNames().stream().map(supportedCommand -> commandBus.subscribe(supportedCommand, this)) .collect(Collectors.toCollection(ArrayDeque::new)); return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false); } AnnotationCommandHandlerAdapter(T annotatedCommandHandler);  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked")  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory,
                                           HandlerDefinition handlerDefinition); }
AnnotationCommandHandlerAdapter implements CommandMessageHandler { public Registration subscribe(CommandBus commandBus) { Collection<Registration> subscriptions = supportedCommandNames().stream().map(supportedCommand -> commandBus.subscribe(supportedCommand, this)) .collect(Collectors.toCollection(ArrayDeque::new)); return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false); } AnnotationCommandHandlerAdapter(T annotatedCommandHandler);  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked")  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory,
                                           HandlerDefinition handlerDefinition); Registration subscribe(CommandBus commandBus); @Override Object handle(CommandMessage<?> command); @Override boolean canHandle(CommandMessage<?> message); @Override Set<String> supportedCommandNames(); }
AnnotationCommandHandlerAdapter implements CommandMessageHandler { public Registration subscribe(CommandBus commandBus) { Collection<Registration> subscriptions = supportedCommandNames().stream().map(supportedCommand -> commandBus.subscribe(supportedCommand, this)) .collect(Collectors.toCollection(ArrayDeque::new)); return () -> subscriptions.stream().map(Registration::cancel).reduce(Boolean::logicalOr).orElse(false); } AnnotationCommandHandlerAdapter(T annotatedCommandHandler);  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked")  AnnotationCommandHandlerAdapter(T annotatedCommandHandler,
                                           ParameterResolverFactory parameterResolverFactory,
                                           HandlerDefinition handlerDefinition); Registration subscribe(CommandBus commandBus); @Override Object handle(CommandMessage<?> command); @Override boolean canHandle(CommandMessage<?> message); @Override Set<String> supportedCommandNames();  }