@Test public void onApplicationEvent() { doNothing().when(userService).addDefaultHabit(anyLong(), anyString()); signInEventListener.onApplicationEvent(new SignInEvent(User.builder().id(1L).build())); verify(userService, times(1)).addDefaultHabit(anyLong(), anyString()); }
@Override public void onApplicationEvent(SignInEvent event) { userService.addDefaultHabit(event.getUser().getId(), "en"); }
SignInEventListener implements ApplicationListener<SignInEvent> { @Override public void onApplicationEvent(SignInEvent event) { userService.addDefaultHabit(event.getUser().getId(), "en"); } }
SignInEventListener implements ApplicationListener<SignInEvent> { @Override public void onApplicationEvent(SignInEvent event) { userService.addDefaultHabit(event.getUser().getId(), "en"); } @Autowired  SignInEventListener(UserService userService); }
SignInEventListener implements ApplicationListener<SignInEvent> { @Override public void onApplicationEvent(SignInEvent event) { userService.addDefaultHabit(event.getUser().getId(), "en"); } @Autowired  SignInEventListener(UserService userService); @Override void onApplicationEvent(SignInEvent event); }
SignInEventListener implements ApplicationListener<SignInEvent> { @Override public void onApplicationEvent(SignInEvent event) { userService.addDefaultHabit(event.getUser().getId(), "en"); } @Autowired  SignInEventListener(UserService userService); @Override void onApplicationEvent(SignInEvent event);  }