@Test
  public void serializeHandlesException() throws IOException {
    // given
    thrown.expect(RuntimeException.class);
    thrown.expectMessage(
        "Exception while serializing verification to JSON with value {"
            + System.getProperty("line.separator")
            + "  \"httpRequest\" : { },"
            + System.getProperty("line.separator")
            + "  \"times\" : {"
            + System.getProperty("line.separator")
            + "    \"count\" : 1,"
            + System.getProperty("line.separator")
            + "    \"exact\" : false"
            + System.getProperty("line.separator")
            + "  }"
            + System.getProperty("line.separator")
            + "}");
    // and
    when(objectMapper.writerWithDefaultPrettyPrinter()).thenReturn(objectWriter);
    when(objectWriter.writeValueAsString(any(VerificationDTO.class)))
        .thenThrow(new RuntimeException("TEST EXCEPTION"));

    // when
    verificationSerializer.serialize(new Verification());
  }
  @Test
  public void deserializeHandleException() throws IOException {
    // given
    thrown.expect(RuntimeException.class);
    thrown.expectMessage("Exception while parsing response [requestBytes] for verification");
    // and
    when(objectMapper.readValue(eq("requestBytes"), same(VerificationDTO.class)))
        .thenThrow(new IOException("TEST EXCEPTION"));

    // when
    verificationSerializer.deserialize("requestBytes");
  }
  @Test
  public void serialize() throws IOException {
    // given
    when(objectMapper.writerWithDefaultPrettyPrinter()).thenReturn(objectWriter);

    // when
    verificationSerializer.serialize(fullVerification);

    // then
    verify(objectMapper).writerWithDefaultPrettyPrinter();
    verify(objectWriter).writeValueAsString(fullVerificationDTO);
  }
  @Test
  public void deserialize() throws IOException {
    // given
    when(objectMapper.readValue(eq("requestBytes"), same(VerificationDTO.class)))
        .thenReturn(fullVerificationDTO);

    // when
    Verification verification = verificationSerializer.deserialize("requestBytes");

    // then
    assertEquals(fullVerification, verification);
  }