@Test(expected = JsonMappingException.class)
  public void givenBidirectionRelation_whenUsingInternalJsonView_thenException()
      throws JsonProcessingException {
    final UserWithView user = new UserWithView(1, "John");
    final ItemWithView item = new ItemWithView(2, "book", user);
    user.addItem(item);

    new ObjectMapper().writerWithView(Views.Internal.class).writeValueAsString(item);
  }
  @Test
  public void givenBidirectionRelation_whenUsingPublicJsonView_thenCorrect()
      throws JsonProcessingException {
    final UserWithView user = new UserWithView(1, "John");
    final ItemWithView item = new ItemWithView(2, "book", user);
    user.addItem(item);

    final String result =
        new ObjectMapper().writerWithView(Views.Public.class).writeValueAsString(item);

    assertThat(result, containsString("book"));
    assertThat(result, containsString("John"));
    assertThat(result, not(containsString("userItems")));
  }