EmailInviteSender implements EventSubscriber<InviteCreatedEvent> { @Inject public void subscribe(EventService eventService) { eventService.subscribe(this, InviteCreatedEvent.class); } @Inject  EmailInviteSender(
      @Named("che.api") String apiEndpoint,
      @Named("che.mail.from_email_address") String mailFrom,
      @Named("workspace.email.invite.subject") String workspaceInviteSubject,
      @Named("organization.email.invite.subject") String organizationInviteSubject,
      DefaultEmailResourceResolver resourceResolver,
      MailSender mailSender,
      UserManager userManager,
      ProfileManager profileManager,
      BearerTokenAuthenticationHandler tokenHandler,
      TemplateProcessor templateProcessor); @Inject void subscribe(EventService eventService); @Override void onEvent(InviteCreatedEvent event); void sendEmail(String initiatorId, Invite invite);  }
@Test public void shouldSubscribeItself() throws Exception { emailSender.subscribe(eventService); verify(eventService).subscribe(emailSender, InviteCreatedEvent.class); }