Ejemplo n.º 1
0
 @Override
 public int compareTo(Object o) {
   Platform t = (Platform) o;
   if (getPlatformId() < t.getPlatformId()) return -1;
   if (getPlatformId() > t.getPlatformId()) return 1;
   return 0;
 }
Ejemplo n.º 2
0
 /**
  * Equivalency is based on getProjectId() if set, otherwise on name, description and creation
  * date.
  */
 @Override
 public boolean equals(Object obj) {
   if (obj == null) return false;
   if (obj == this) return true;
   if (!(obj instanceof Platform)) return false;
   Platform them = (Platform) obj;
   // If not saved, then compare resolved actual objects. Otherwise
   // just compare IDs.
   if (getPlatformId() == AbstractPlatform.UNSAVED_ID
       || them.getPlatformId() == AbstractPlatform.UNSAVED_ID) {
     return getPlatformType().equals(them.getPlatformType())
         && getDescription().equals(them.getDescription());
   } else {
     return getPlatformId().longValue() == them.getPlatformId().longValue();
   }
 }
Ejemplo n.º 3
0
  @Test
  public void testPlatforms() {
    try {
      // get row count of experiments in the dataset
      int expected = getDataSet().getTable("Platform").getRowCount();

      // get number of experiments from the DAO
      int actual = getPlatformDAO().count();

      // test data contains 2 experiments, check size of returned list
      TestCase.assertEquals("Wrong number of Platform", expected, actual);
      System.out.println("Expected number of Platform: " + expected + ", actual: " + actual);

      for (Platform d : random(getPlatformDAO(), actual, 5)) {
        TestCase.assertNotNull(d);
        TestCase.assertNotNull(d.getPlatformId());
      }
    } catch (Exception e) {
      e.printStackTrace();
      TestCase.fail();
    }
  }