@Test public void testRemoveAllNotifications() throws Exception { when(environment.getArgument("username")).thenReturn("test"); final Boolean actual = mutation.get(environment); verify(store).removeAll(eq("test")); assertThat(actual).isTrue(); }
@Override public Boolean get(DataFetchingEnvironment environment) { final String username = environment.getArgument("username"); if (Strings.isNullOrEmpty(username)) { throw new GraphQLValidationError("username cannot be empty"); } try { store.removeAll(username); } catch (NotificationStoreException e) { LOGGER.error(String.format("Unable to remove all notifications for %s", username), e); throw new GraphQLValidationError("Unable to remove all notifications"); } return true; }
RemoveAllNotificationsMutation implements DataFetcher<Boolean> { @Override public Boolean get(DataFetchingEnvironment environment) { final String username = environment.getArgument("username"); if (Strings.isNullOrEmpty(username)) { throw new GraphQLValidationError("username cannot be empty"); } try { store.removeAll(username); } catch (NotificationStoreException e) { LOGGER.error(String.format("Unable to remove all notifications for %s", username), e); throw new GraphQLValidationError("Unable to remove all notifications"); } return true; } }
RemoveAllNotificationsMutation implements DataFetcher<Boolean> { @Override public Boolean get(DataFetchingEnvironment environment) { final String username = environment.getArgument("username"); if (Strings.isNullOrEmpty(username)) { throw new GraphQLValidationError("username cannot be empty"); } try { store.removeAll(username); } catch (NotificationStoreException e) { LOGGER.error(String.format("Unable to remove all notifications for %s", username), e); throw new GraphQLValidationError("Unable to remove all notifications"); } return true; } RemoveAllNotificationsMutation(final NotificationStore store); }
RemoveAllNotificationsMutation implements DataFetcher<Boolean> { @Override public Boolean get(DataFetchingEnvironment environment) { final String username = environment.getArgument("username"); if (Strings.isNullOrEmpty(username)) { throw new GraphQLValidationError("username cannot be empty"); } try { store.removeAll(username); } catch (NotificationStoreException e) { LOGGER.error(String.format("Unable to remove all notifications for %s", username), e); throw new GraphQLValidationError("Unable to remove all notifications"); } return true; } RemoveAllNotificationsMutation(final NotificationStore store); @Override Boolean get(DataFetchingEnvironment environment); }
RemoveAllNotificationsMutation implements DataFetcher<Boolean> { @Override public Boolean get(DataFetchingEnvironment environment) { final String username = environment.getArgument("username"); if (Strings.isNullOrEmpty(username)) { throw new GraphQLValidationError("username cannot be empty"); } try { store.removeAll(username); } catch (NotificationStoreException e) { LOGGER.error(String.format("Unable to remove all notifications for %s", username), e); throw new GraphQLValidationError("Unable to remove all notifications"); } return true; } RemoveAllNotificationsMutation(final NotificationStore store); @Override Boolean get(DataFetchingEnvironment environment);  }