package io.github.pyranja.hamcrest.jaxrs;

import org.mockito.Mockito;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import static org.mockito.Mockito.when;

/**
 * Factory methods for jaxrs.Response mocks
 */
public final class MockResponse {
  private MockResponse() { /* no instances */ }

  /**
   * Create mock response with given status only.
   */
  static Response with(final Response.StatusType status) {
    final Response mock = Mockito.mock(Response.class);
    when(mock.getStatusInfo()).thenReturn(status);
    when(mock.getStatus()).thenReturn(status.getStatusCode());
    return mock;
  }

  static Response having(final MediaType mime) {
    final Response mock = Mockito.mock(Response.class);
    when(mock.getMediaType()).thenReturn(mime);
    return mock;
  }
}

@@ -624,16 +624,79 @@
 k;%0A  %7D%0A%0A
+  /**%0A   * Create mock response with given content type.%0A   */%0A
   static
@@ -860,11 +860,382 @@
 ock;%0A  %7D
+%0A%0A  /**%0A   * Create mock response with given entity%0A   */%0A  static %3CCONTENT%3E Response containing(final Class%3CCONTENT%3E type, final CONTENT content) %7B%0A    final Response mock = Mockito.mock(Response.class);%0A    when(mock.hasEntity()).thenReturn(true);%0A    when(mock.getEntity()).thenReturn(content);%0A    when(mock.readEntity(type)).thenReturn(content);%0A    return mock;%0A  %7D
 %0A%7D%0A

Add factory for mock responses with entity