コード例 #1
0
ファイル: WordTest.java プロジェクト: zAthena/word-mindmap
  @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
ファイル: WordTest.java プロジェクト: zAthena/word-mindmap
 @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"));
 }