예제 #1
0
  /**
   * Tests the behavior of reference <code>conflict</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testConflict() {
    EStructuralFeature feature =
        org.eclipse.emf.compare.ComparePackage.eINSTANCE.getDiff_Conflict();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.compare.Conflict conflictValue =
        org.eclipse.emf.compare.CompareFactory.eINSTANCE.createConflict();

    assertFalse(referenceChange.eIsSet(feature));
    assertNull(referenceChange.getConflict());

    referenceChange.setConflict(conflictValue);
    assertTrue(notified);
    notified = false;
    assertSame(conflictValue, referenceChange.getConflict());
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature));
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));
    assertTrue(conflictValue.getDifferences().contains(referenceChange));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getConflict());
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature));
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));
    assertFalse(conflictValue.getDifferences().contains(referenceChange));

    referenceChange.setConflict(conflictValue);
    assertTrue(notified);
    notified = false;
    assertSame(conflictValue, referenceChange.getConflict());
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature));
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));
    assertTrue(conflictValue.getDifferences().contains(referenceChange));

    referenceChange.eSet(feature, conflictValue);
    assertTrue(notified);
    notified = false;
    assertSame(conflictValue, referenceChange.getConflict());
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature));
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));
    assertTrue(conflictValue.getDifferences().contains(referenceChange));

    referenceChange.setConflict(null);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getConflict());
    assertSame(feature.getDefaultValue(), referenceChange.getConflict());
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature));
    assertSame(referenceChange.getConflict(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));
    assertFalse(conflictValue.getDifferences().contains(referenceChange));
  }
예제 #2
0
  /**
   * Tests the behavior of reference <code>value</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testValue() {
    EStructuralFeature feature =
        org.eclipse.emf.compare.ComparePackage.eINSTANCE.getReferenceChange_Value();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.ecore.EObject valueValue =
        org.eclipse.emf.ecore.EcoreFactory.eINSTANCE.createEObject();

    assertFalse(referenceChange.eIsSet(feature));
    assertNull(referenceChange.getValue());

    referenceChange.setValue(valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));

    referenceChange.setValue(valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eSet(feature, valueValue);
    assertTrue(notified);
    notified = false;
    assertSame(valueValue, referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.setValue(null);
    assertTrue(notified);
    notified = false;
    assertNull(referenceChange.getValue());
    assertSame(feature.getDefaultValue(), referenceChange.getValue());
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature));
    assertSame(referenceChange.getValue(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));
  }
예제 #3
0
  /**
   * Tests the behavior of attribute <code>kind</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testKind() {
    EStructuralFeature feature = org.eclipse.emf.compare.ComparePackage.eINSTANCE.getDiff_Kind();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.compare.DifferenceKind kindValue =
        (org.eclipse.emf.compare.DifferenceKind) feature.getDefaultValue();
    for (org.eclipse.emf.compare.DifferenceKind aDifferenceKind :
        org.eclipse.emf.compare.DifferenceKind.VALUES) {
      if (kindValue.getValue() != aDifferenceKind.getValue()) {
        kindValue = aDifferenceKind;
        break;
      }
    }

    assertFalse(referenceChange.eIsSet(feature));
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());

    referenceChange.setKind(kindValue);
    assertTrue(notified);
    notified = false;
    assertEquals(kindValue, referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertFalse(referenceChange.eIsSet(feature));

    referenceChange.eSet(feature, kindValue);
    assertTrue(notified);
    notified = false;
    assertEquals(kindValue, referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertTrue(referenceChange.eIsSet(feature));

    referenceChange.setKind(null);
    assertTrue(notified);
    notified = false;
    assertEquals(feature.getDefaultValue(), referenceChange.getKind());
    assertEquals(referenceChange.getKind(), referenceChange.eGet(feature));
    assertFalse(referenceChange.eIsSet(feature));
  }
예제 #4
0
  /**
   * Tests the behavior of reference <code>requiredBy</code>'s accessors.
   *
   * @generated
   */
  @Test
  public void testRequiredBy() {
    EStructuralFeature feature =
        org.eclipse.emf.compare.ComparePackage.eINSTANCE.getDiff_RequiredBy();
    ReferenceChange referenceChange = CompareFactory.eINSTANCE.createReferenceChange();
    referenceChange.eAdapters().add(new MockEAdapter());
    org.eclipse.emf.compare.Diff requiredByValue =
        org.eclipse.emf.compare.CompareFactory.eINSTANCE.createDiff();
    List<org.eclipse.emf.compare.Diff> listRequiredBy =
        new ArrayList<org.eclipse.emf.compare.Diff>(1);
    listRequiredBy.add(requiredByValue);

    assertFalse(referenceChange.eIsSet(feature));
    assertTrue(referenceChange.getRequiredBy().isEmpty());

    referenceChange.getRequiredBy().add(requiredByValue);
    assertTrue(notified);
    notified = false;
    assertTrue(referenceChange.getRequiredBy().contains(requiredByValue));
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature));
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));
    assertTrue(requiredByValue.getRequires().contains(referenceChange));

    referenceChange.eUnset(feature);
    assertTrue(notified);
    notified = false;
    assertTrue(referenceChange.getRequiredBy().isEmpty());
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature));
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature, false));
    assertFalse(referenceChange.eIsSet(feature));
    assertFalse(requiredByValue.getRequires().contains(referenceChange));

    referenceChange.eSet(feature, listRequiredBy);
    assertTrue(notified);
    notified = false;
    assertTrue(referenceChange.getRequiredBy().contains(requiredByValue));
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature));
    assertSame(referenceChange.getRequiredBy(), referenceChange.eGet(feature, false));
    assertTrue(referenceChange.eIsSet(feature));
    assertTrue(requiredByValue.getRequires().contains(referenceChange));
  }