@Test
  public void thatSomeLinksAreCreated() throws Exception {
    UpdateContactInformationWithSomeLinksRequest request =
        new UpdateContactInformationWithSomeLinksRequest();

    UpdateSomeLink facebook = new UpdateSomeLink();
    facebook.type = "FACEBOOK";
    facebook.url = "http://facebook.com";

    UpdateSomeLink twitter = new UpdateSomeLink();
    twitter.type = "TWITTER";
    twitter.url = "http://twitter.com";

    request.someLinks.addAll(Lists.newArrayList(facebook, twitter));

    mockMvc
        .perform(
            post("/api/private/v1/portfolio/2/contactinformation")
                .with(securityContext(studentSecurityContext()))
                .contentType(MediaType.APPLICATION_JSON)
                .content(WebTestUtils.toJsonBytes(request)))
        .andExpect(status().isOk())
        .andExpect(jsonPath("$.someLinks", hasSize(2)))
        .andExpect(jsonPath("$.someLinks[0].type").value("FACEBOOK"))
        .andExpect(jsonPath("$.someLinks[0].url").value("http://facebook.com"))
        .andExpect(jsonPath("$.someLinks[1].type").value("TWITTER"))
        .andExpect(jsonPath("$.someLinks[1].url").value("http://twitter.com"));
  }
  @Test
  public void thatContactInformationIsUpdated() throws Exception {
    UpdateContactInformationWithSomeLinksRequest request =
        new UpdateContactInformationWithSomeLinksRequest();
    request.email = "*****@*****.**";
    request.phoneNumber = "123456789";

    mockMvc
        .perform(
            post("/api/private/v1/portfolio/2/contactinformation")
                .with(securityContext(studentSecurityContext()))
                .contentType(MediaType.APPLICATION_JSON)
                .content(WebTestUtils.toJsonBytes(request)))
        .andExpect(status().isOk())
        .andExpect(jsonPath("$.email").value("*****@*****.**"))
        .andExpect(jsonPath("$.phoneNumber").value("123456789"));
  }
  @Test
  public void thatSomeLinksAreDeleted() throws Exception {
    persistSomeLink(2L);
    assertThat(someLinkRepository.findByPortfolioId(2L).isEmpty()).isFalse();

    UpdateContactInformationWithSomeLinksRequest request =
        new UpdateContactInformationWithSomeLinksRequest();

    mockMvc
        .perform(
            post("/api/private/v1/portfolio/2/contactinformation")
                .with(securityContext(studentSecurityContext()))
                .contentType(MediaType.APPLICATION_JSON)
                .content(WebTestUtils.toJsonBytes(request)))
        .andExpect(status().isOk());

    assertThat(someLinkRepository.findByPortfolioId(2L).isEmpty()).isTrue();
  }
  @Test
  public void thatFeedbackIsInserted() throws Exception {
    InsertFeedbackRequest request = new InsertFeedbackRequest();
    request.content = "Content";
    request.email = "*****@*****.**";
    request.metadata = getMetadata();

    mockMvc
        .perform(
            post(RestConstants.PUBLIC_API_V1 + "/feedback")
                .with(securityContext(studentSecurityContext()))
                .content(WebTestUtils.toJsonBytes(request))
                .contentType(MediaType.APPLICATION_JSON))
        .andExpect(status().isOk());

    assertThat(feedbackRepository.findAll()).hasSize(4);

    Feedback feedback = feedbackRepository.findAll().get(3);

    assertThat(feedback.content).isEqualTo(request.content);
    assertThat(feedback.email).isEqualTo(request.email);
    assertThat(feedback.metadata).isEqualTo("{\"browser\":\"Chrome\"}");
  }