Пример #1
0
 public void testGenerateClassNamesMultiple() throws Exception {
   Model model = Model.getInstanceByName("testmodel");
   String classNames = " Company Department ";
   String expected =
       "org.intermine.model.testmodel.Company org.intermine.model.testmodel.Department";
   assertEquals(expected, ItemHelper.generateClassNames(classNames, model));
 }
 @ForgeSubscribe
 public void onEntityLivingDeath(LivingDeathEvent event) {
   if (event.source.getDamageType().equals("player")) {
     ItemHelper.dropBottlecap((EntityPlayer) event.source.getSourceOfDamage(), event.entityLiving);
   }
   if (event.source.getSourceOfDamage() instanceof EntityArrow) {
     if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity != null) {
       if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity
           instanceof EntityPlayer) {
         ItemHelper.dropBottlecap(
             (EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity,
             event.entityLiving);
       }
     }
   }
 }
Пример #3
0
  public void testConvertReferenceList() throws Exception {
    org.intermine.model.fulldata.ReferenceList resRefList = ItemHelper.convert(referenceList);
    resRefList.proxyItem(departmentProxy);

    // referencelists are simple objects so don't have .equals() on id like InterMineObjects
    // need to check each field
    assertEquals(dbReferenceList.getName(), resRefList.getName());
    assertEquals(dbReferenceList.getFieldProxy("item"), resRefList.getFieldProxy("item"));
    assertEquals(dbReferenceList.getRefIds(), resRefList.getRefIds());
  }
Пример #4
0
 public void testConvertFromDbItem() throws Exception {
   assertEquals(item, ItemHelper.convert(dbItem));
 }
Пример #5
0
 public void testGenerateClassNamesSingle() throws Exception {
   Model model = Model.getInstanceByName("testmodel");
   assertEquals(
       "org.intermine.model.testmodel.Company", ItemHelper.generateClassNames("Company", model));
 }
Пример #6
0
 public void testGenerateClassNamesEmpty() throws Exception {
   Model model = Model.getInstanceByName("testmodel");
   assertEquals("", ItemHelper.generateClassNames("", model));
 }
Пример #7
0
 public void testGenerateClassNamesNull() throws Exception {
   assertNull(ItemHelper.generateClassNames(null, null));
 }