- verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
- }
-
-
- @Test
- public void Given_Request_Is_HTTP_POST_And_Change_On_Feeds_Succeeds_A_STATUS_OK_Response_Is_Generated() throws Exception {
- ServletOutputStream outStream = mock(ServletOutputStream.class);
- when(response.getOutputStream()).thenReturn(outStream);
- PowerMockito.mockStatic(Subscription.class);
- PowerMockito.when(Subscription.getSubscriptionMatching(mock(Subscription.class))).thenReturn(null);
- JSONObject JSObject = buildRequestJsonObject();
- SubscribeServlet subscribeServlet = new SubscribeServlet() {
- protected JSONObject getJSONfromInput(HttpServletRequest req) {
- JSONObject jo = new JSONObject();
- jo.put("name", "stub_name");
- jo.put("version", "2.0");
- jo.put("metadataOnly", true);
- jo.put("suspend", true);
- jo.put("delivery", JSObject);
- jo.put("sync", true);
- return jo;
- }
-
- @Override
- protected boolean doInsert(Insertable bean) {
- return true;
- }
- };
- subscribeServlet.doPost(request, response);
- verify(response).setStatus(eq(HttpServletResponse.SC_CREATED));
- verifyEnteringExitCalled(listAppender);