Advertisement
Guest User

Untitled

a guest
May 29th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. package exam2;
  2.  
  3. import static org.junit.Assert.assertEquals;
  4. import static org.junit.Assert.fail;
  5.  
  6. import org.junit.Test;
  7.  
  8. public class PartTypeTest {
  9.     public enum ExpPartType {
  10.         COMPONENTS, SINGLE_COMPONENT, RESOURCE;
  11.     }
  12.  
  13.     @Test
  14.     public void testValues() {
  15.         assertEquals("The enumeration PartType should have the right number of values!", ExpPartType.values().length,
  16.                 PartType.values().length);
  17.         for (ExpPartType e : ExpPartType.values()) {
  18.             try {
  19.                 assertEquals("PartType." + e.name()
  20.                         + " should be at the correct position within the enumeration PartType!", e.ordinal(), PartType
  21.                         .valueOf(e.name()).ordinal());
  22.             } catch (Exception ex) {
  23.                 fail("The enumeration PartType should possess the value " + e.name() + "!");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement