@Test
public void Given_Request_Is_HTTP_PUT_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
groupServlet.doPut(request, response);
@Test
public void Given_Request_Is_HTTP_PUT_And_Group_Name_Is_Too_Long_Then_Bad_Request_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(true);
groupServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@Test
public void Given_Request_Is_HTTP_PUT_And_PUT_Fails_Then_Internal_Server_Error_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail();
groupServlet.doPut(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
@Test
public void Given_Request_Is_HTTP_PUT_And_Request_Succeeds() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnGroupInDb();
ServletOutputStream outStream = mock(ServletOutputStream.class);
when(response.getOutputStream()).thenReturn(outStream);
@Test
public void Given_Request_Is_HTTP_POST_And_Request_Contains_Badly_Formed_JSON_Then_Bad_Request_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
ServletInputStream inStream = mock(ServletInputStream.class);
when(request.getInputStream()).thenReturn(inStream);
groupServlet.doPost(request, response);
@Test
public void Given_Request_Is_HTTP_POST_And_Group_Description_Is_Too_Long_Then_Bad_Request_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAnInvalidGroup(false);
groupServlet.doPost(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@Test
public void Given_Request_Is_HTTP_POST_And_Group_Name_Already_Exists_Then_Bad_Request_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnGroupInDb();
groupServlet.doPost(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
@Test
public void Given_Request_Is_HTTP_POST_And_POST_Fails_Then_Internal_Server_Error_Response_Is_Generated() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnAValidGroupWithFail();
groupServlet.doPost(request, response);
verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
@Test
public void Given_Request_Is_HTTP_POST_And_Request_Succeeds() throws Exception {
- when(request.getHeader("Content-Type")).thenReturn("application/vnd.att-dr.group; version=1.0");
+ when(request.getHeader("Content-Type")).thenReturn("application/vnd.dmaap-dr.group; version=1.0");
GroupServlet groupServlet = overideGetJSONFromInputToReturnNewGroupToInsert();
ServletOutputStream outStream = mock(ServletOutputStream.class);
when(response.getOutputStream()).thenReturn(outStream);