示例#1
0
  @Test
  public void shouldGetExtensionFromOtherSide() {
    wordRepository.save(earth);
    wordRepository.save(sky);
    assertThat("sky's extensions count", sky.getExtensionsCount(), is(0));

    // as earth and sky both are under controll of springdata graph, no need to further call
    // earth.save()
    earth.extendWith(sky, "earth and sky just intuitive");
    assertThat("sky's extensions count", sky.getExtensionsCount(), is(equalTo(1)));
    assertThat("sky's extensions contains sky", sky.getExtensions(), hasItem(earth));
  }
示例#2
0
 @Test
 public void shouldGetExtensionFromSavingSide() {
   wordRepository.save(earth);
   assertThat("earth's extensions count", earth.getExtensionsCount(), is(0));
   wordRepository.save(sky);
   // as earth and sky both are under controll of springdata graph, no need to further call
   // earth.save()
   earth.extendWith(sky, "earth and sky just intuitive");
   assertThat("earth's extensions count", earth.getExtensionsCount(), is(equalTo(1)));
   assertThat("earth's extensions contains sky", earth.getExtensions(), hasItem(sky));
   Relationship relationship = earth.getExtensionRelationshipTo(sky);
   assertThat("relationship should work properly", relationship.getWord(), is(earth));
   assertThat("relationship should work properly", relationship.getAnotherWord(), is(sky));
   assertThat(
       "relationship should work properly",
       relationship.getOnEnglish(),
       is("earth and sky just intuitive"));
 }