@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)); }
private void assertionsForPlatformEntityAndChildVideoGameEntity( String expectedPlatformName, String expectedVideoGameName1, String expectedVideoGameName2, Date expectedDateReleased, PlatformEntity savedPlatformEntity) { assertThat(savedPlatformEntity.getPlatformName(), is(expectedPlatformName)); assertThat( savedPlatformEntity.getVideoGameEntities(), IsIterableContainingInAnyOrder.<VideoGameEntity>containsInAnyOrder( hasProperty("videoGameName", is(expectedVideoGameName1)), hasProperty("dateReleased", is(expectedDateReleased)))); assertThat( savedPlatformEntity.getVideoGameEntities(), IsIterableContainingInAnyOrder.<VideoGameEntity>containsInAnyOrder( hasProperty("videoGameName", is(expectedVideoGameName2)), hasProperty("dateReleased", is(expectedDateReleased)))); }