public void testFindEquipmentByBaseKey() { TestHelper.makeSizeAdjustments(); Equipment towel = new Equipment(); towel.setName("Towel"); Equipment backpackMed = new Equipment(); backpackMed.setName("Backpack"); final Equipment backpackSml = backpackMed.clone(); backpackSml.put(ObjectKey.BASE_ITEM, CDOMDirectSingleRef.getRef(backpackMed)); SizeAdjustment small = Globals.getContext().ref.getAbbreviatedObject(SizeAdjustment.class, "S"); final String newName = backpackSml.createNameForAutoResize(small); backpackSml.setName(newName); backpackSml.setKeyName(backpackSml.createKeyForAutoResize(small)); List<Equipment> eqList = new ArrayList<Equipment>(); eqList.add(towel); eqList.add(backpackSml); assertEquals( "Expected to find backpack", backpackSml, EquipmentUtilities.findEquipmentByBaseKey(eqList, "backpack")); assertEquals( "Expected not to find torch", null, EquipmentUtilities.findEquipmentByBaseKey(eqList, "torch")); assertEquals( "Expected to find towel", towel, EquipmentUtilities.findEquipmentByBaseKey(eqList, "ToWeL")); }
/** Test method for 'pcgen.core.EquipmentUtilities.appendToName(String, String)' */ public void testAppendToName() { final String bare = "Bare Thing"; final String decoration = "Mad cow"; is( EquipmentUtilities.appendToName(bare, decoration), strEq("Bare Thing (Mad cow)"), "Choice appends to name correctly"); }