Crafting System Testing Plan Sprint Two - UQdeco2800/2022-studio-2 GitHub Wiki

In this section, the components tested for sprint one will be discussed. The method used are:

  1. JUnit testing.
  2. Sonarcloud testing.

Junit Testing

Components tested

  1. CraftingLogic.java

  2. CraftingSystem.java

Details of testing methods implementations, please refer to hhttps://github.com/UQdeco2800/2022-studio-2/wiki/Crafting-System-Code-Implementation-Sprint-Two

Error

image image This test failed is due to wrong implementation of the testing method, failed to use AssertSame(). Now:

@Test
void getWeaponsTest() {
        WeaponConfig configs =
                FileLoader.readClass(WeaponConfig.class, "configs/Weapons.json");
        List<MeleeConfig> possibleWeaponsTest = new ArrayList<>();
        possibleWeaponsTest.add(configs.athenaDag);
        possibleWeaponsTest.add(configs.herraDag);
        possibleWeaponsTest.add(configs.SwordLvl2);
        possibleWeaponsTest.add(configs.dumbbell);
        possibleWeaponsTest.add(configs.tridentLvl2);
        possibleWeaponsTest.add(configs.herraAthenaDag);
        possibleWeaponsTest.add(configs.plunger);
        assertNotSame(possibleWeaponsTest,CraftingLogic.getPossibleWeapons());

    }
@Test
void canBuildTest() {
    List<MeleeConfig> buildItemsTest = new ArrayList<>();
    List<Materials> inventoryContentsTest = new ArrayList<>();
    CraftingLogic.canBuild(inventoryContentsTest);
    assertEquals(CraftingLogic.canBuild(inventoryContentsTest), buildItemsTest);
}
⚠️ **GitHub.com Fallback** ⚠️