@Test public void testOneGroup() throws Exception { CasteCollection casteCollection = new NullCasteCollection(); GroupedTraitType[] abilityTypes = new GroupedTraitType[] { new GroupedTraitType(Archery, "War", Collections.<String>emptyList()), new GroupedTraitType(Melee, "War", Collections.<String>emptyList()) }; IdentifiedTraitTypeList[] typeGroups = factory.createTraitGroups(casteCollection, abilityTypes); assertEquals(1, typeGroups.length); assertThat(typeGroups[0].getAll(), contains(Archery, Melee)); assertEquals(War, typeGroups[0].getListId()); }
@Test public void usesCasteAsGroupIdentificate() throws Exception { CasteTemplate template = new CasteTemplate(); template.castes.add(TEST_CASTE_ID); CasteCollection casteCollection = new ConfigurableCasteCollection(template); GroupedTraitType[] abilityTypes = new GroupedTraitType[] { new GroupedTraitType(Archery, TEST_CASTE_ID, Collections.singletonList(TEST_CASTE_ID)), new GroupedTraitType(Melee, TEST_CASTE_ID, Collections.singletonList(TEST_CASTE_ID)) }; IdentifiedTraitTypeList[] typeGroups = factory.createTraitGroups(casteCollection, abilityTypes); assertEquals(1, typeGroups.length); assertThat(typeGroups[0].getAll(), contains(Archery, Melee)); assertSame(casteCollection.getById(TEST_CASTE_ID), typeGroups[0].getListId()); }