@Test public void responseIsBadRequest_IfNexusIsClusteredAndFormatIsNotClustered() throws Exception { when(highAvailabilitySupportChecker.isSupported(FORMAT_NAME)).thenReturn(false); final Response response = handlerUnderTest.handle(context); verify(highAvailabilitySupportChecker).isSupported(FORMAT_NAME); assertThat(response.getStatus().getCode(), is(HttpStatus.BAD_REQUEST)); }
@Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String format = context.getRepository().getFormat().getValue(); if (!highAvailabilitySupportChecker.isSupported(format)) { return badRequest(format("%s is not supported in clustered mode.", format)); } return context.proceed(); }
FormatHighAvailabilitySupportHandler implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String format = context.getRepository().getFormat().getValue(); if (!highAvailabilitySupportChecker.isSupported(format)) { return badRequest(format("%s is not supported in clustered mode.", format)); } return context.proceed(); } }
FormatHighAvailabilitySupportHandler implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String format = context.getRepository().getFormat().getValue(); if (!highAvailabilitySupportChecker.isSupported(format)) { return badRequest(format("%s is not supported in clustered mode.", format)); } return context.proceed(); } @Inject  FormatHighAvailabilitySupportHandler(final HighAvailabilitySupportChecker highAvailabilitySupportChecker); }
FormatHighAvailabilitySupportHandler implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String format = context.getRepository().getFormat().getValue(); if (!highAvailabilitySupportChecker.isSupported(format)) { return badRequest(format("%s is not supported in clustered mode.", format)); } return context.proceed(); } @Inject  FormatHighAvailabilitySupportHandler(final HighAvailabilitySupportChecker highAvailabilitySupportChecker); @Nonnull @Override Response handle(@Nonnull final Context context); }
FormatHighAvailabilitySupportHandler implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String format = context.getRepository().getFormat().getValue(); if (!highAvailabilitySupportChecker.isSupported(format)) { return badRequest(format("%s is not supported in clustered mode.", format)); } return context.proceed(); } @Inject  FormatHighAvailabilitySupportHandler(final HighAvailabilitySupportChecker highAvailabilitySupportChecker); @Nonnull @Override Response handle(@Nonnull final Context context);  }