Ejemplo n.º 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);
       }
     }
   }
 }
Ejemplo n.º 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());
  }
Ejemplo n.º 4
0
 public void testConvertFromDbItem() throws Exception {
   assertEquals(item, ItemHelper.convert(dbItem));
 }
Ejemplo n.º 5
0
 public void testGenerateClassNamesSingle() throws Exception {
   Model model = Model.getInstanceByName("testmodel");
   assertEquals(
       "org.intermine.model.testmodel.Company", ItemHelper.generateClassNames("Company", model));
 }
Ejemplo n.º 6
0
 public void testGenerateClassNamesEmpty() throws Exception {
   Model model = Model.getInstanceByName("testmodel");
   assertEquals("", ItemHelper.generateClassNames("", model));
 }
Ejemplo n.º 7
0
 public void testGenerateClassNamesNull() throws Exception {
   assertNull(ItemHelper.generateClassNames(null, null));
 }