コード例 #1
0
 /**
  * Tests the behavior of the {@link DifferenceSource#get(java.lang.String)} method.
  *
  * @generated
  */
 @Test
 public void testGetString() {
   for (DifferenceSource value : DifferenceSource.VALUES) {
     assertSame(DifferenceSource.get(value.getLiteral()), value);
   }
   assertNull(DifferenceSource.get("ThisIsNotAValueOfTheTestedEnum"));
 }
コード例 #2
0
 /**
  * Tests the behavior of the {@link DifferenceSource#getByName(java.lang.String)} method.
  *
  * @generated
  */
 @Test
 public void testGetByName() {
   for (DifferenceSource value : DifferenceSource.VALUES) {
     assertSame(DifferenceSource.getByName(value.getName()), value);
   }
   assertNull(DifferenceSource.getByName("ThisIsNotTheNameOfAValueFromTheTestedEnum"));
 }
コード例 #3
0
 /**
  * Ensures that converting {@link DifferenceSource} to String can be done through the factory.
  *
  * @generated
  */
 @Test
 public void testConvertDifferenceSourceToString() {
   for (DifferenceSource value : DifferenceSource.VALUES) {
     Object result =
         CompareFactory.eINSTANCE.convertToString(
             ComparePackage.Literals.DIFFERENCE_SOURCE, value);
     assertNotNull(result);
     assertEquals(value.toString(), result);
   }
 }
コード例 #4
0
  /**
   * Ensures that creating {@link DifferenceSource} from String can be done through the factory.
   *
   * @generated
   */
  @Test
  public void testCreateDifferenceSourceFromString() {
    for (DifferenceSource value : DifferenceSource.VALUES) {
      Object result =
          CompareFactory.eINSTANCE.createFromString(
              ComparePackage.Literals.DIFFERENCE_SOURCE, value.getLiteral());
      assertNotNull(result);
      assertSame(value, result);

      try {
        CompareFactory.eINSTANCE.createFromString(
            ComparePackage.Literals.DIFFERENCE_SOURCE, "ThisShouldntBeAKnownEEnumLiteral");
        fail("Expected IllegalArgumentException hasn't been thrown");
      } catch (IllegalArgumentException e) {
        // Expected behavior
      }
    }
  }
コード例 #5
0
 /**
  * Tests the behavior of the {@link DifferenceSource#get(int)} method.
  *
  * @generated
  */
 @Test
 public void testGetInt() {
   int highestValue = -1;
   for (DifferenceSource value : DifferenceSource.VALUES) {
     assertSame(DifferenceSource.get(value.getValue()), value);
     if (value.getValue() > highestValue) {
       highestValue = value.getValue();
     }
   }
   assertNull(DifferenceSource.get(++highestValue));
 }