@Test
  public void deletePlatformEntity() throws Exception {
    long platformIdToDelete = 22L;

    assertThat(platformService.findById(platformIdToDelete), is(notNullValue()));
    platformService.delete(platformIdToDelete);
    assertThat(platformService.findById(platformIdToDelete), is(nullValue()));
  }
  @Test
  public void createAndFindPlatformEntityAndItsChildren() throws Exception {
    String expectedPlatformName = "platformOne";

    String expectedVideoGameName1 = "Some Awesome title";
    String expectedVideoGameName2 = "Another Awesome title";

    Date dateReleased = new Date();

    PlatformEntity platformEntity = new PlatformEntity();
    platformEntity.setPlatformName(expectedPlatformName);

    VideoGameEntity videoGameEntity1 = new VideoGameEntity();
    videoGameEntity1.setVideoGameName(expectedVideoGameName1);
    videoGameEntity1.setDateReleased(dateReleased);
    videoGameEntity1.setVideoGameStatusType(VideoGameStatusType.COMPLETED);
    videoGameEntity1.setPlatformEntity(platformEntity);

    VideoGameEntity videoGameEntity2 = new VideoGameEntity();
    videoGameEntity2.setVideoGameName(expectedVideoGameName2);
    videoGameEntity2.setDateReleased(dateReleased);
    videoGameEntity2.setVideoGameStatusType(VideoGameStatusType.BACKLOG);
    videoGameEntity2.setPlatformEntity(platformEntity);

    platformEntity.getVideoGameEntities().add(videoGameEntity1);
    platformEntity.getVideoGameEntities().add(videoGameEntity2);

    PlatformEntity savedPlatformEntity = platformService.create(platformEntity);

    assertionsForPlatformEntityAndChildVideoGameEntity(
        expectedPlatformName,
        expectedVideoGameName1,
        expectedVideoGameName2,
        dateReleased,
        savedPlatformEntity);

    PlatformEntity retrievedPlatformEntity =
        platformService.findById(savedPlatformEntity.getPlatformId());

    assertThat(retrievedPlatformEntity.getPlatformId(), is(savedPlatformEntity.getPlatformId()));
    assertionsForPlatformEntityAndChildVideoGameEntity(
        expectedPlatformName,
        expectedVideoGameName1,
        expectedVideoGameName2,
        dateReleased,
        retrievedPlatformEntity);

    List<PlatformEntity> platformEntities = platformService.findAll();

    assertThat(platformEntities.size(), is(3));
    assertionsForPlatformEntityAndChildVideoGameEntity(
        expectedPlatformName,
        expectedVideoGameName1,
        expectedVideoGameName2,
        dateReleased,
        retrievedPlatformEntity);
  }
  @Test
  public void updatePlatformEntity() throws Exception {
    long existingPlatformId = 22L;
    String updatedPlatformName = "I've updated the name";

    PlatformEntity updatedPlatformEntity = new PlatformEntity();
    updatedPlatformEntity.setPlatformId(existingPlatformId);
    updatedPlatformEntity.setPlatformName(updatedPlatformName);

    PlatformEntity retrievedPlatformEntity = platformService.update(updatedPlatformEntity);

    assertThat(retrievedPlatformEntity.getPlatformId(), is(existingPlatformId));
    assertThat(retrievedPlatformEntity.getPlatformName(), is(updatedPlatformName));
    assertThat(retrievedPlatformEntity.getVideoGameEntities().isEmpty(), is(true));
  }