Ejemplo n.º 1
0
  @Test
  public void testAddChildren() throws OseeCoreException {
    List<? extends ArtifactReadable> children = Arrays.asList(readable2, readable3);

    when(txData.getWriteable(readable1)).thenReturn(artifact1);
    when(txData.getWriteable(readable2)).thenReturn(artifact2);
    when(txData.getWriteable(readable3)).thenReturn(artifact3);
    when(txData.getGraph()).thenReturn(graph);

    ArtifactData data = Mockito.mock(ArtifactData.class);
    when(artifact1.getOrcsData()).thenReturn(data);
    when(artifact2.getOrcsData()).thenReturn(data);
    when(artifact3.getOrcsData()).thenReturn(data);
    when(data.isUseBackingData()).thenReturn(false);

    txDataManager.addChildren(txData, readable1, children);

    verify(relationManager).addChildren(eq(session), eq(artifact1), nodeCaptor.capture());

    Iterator<? extends RelationNode> iterator = nodeCaptor.getValue().iterator();
    assertEquals(artifact2, iterator.next());
    assertEquals(artifact3, iterator.next());
  }