/** Tests addGroup(Group group) method with accuracy state. */ public void testAddGroupAccuracy() { assertEquals("addSection1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroup(group1); assertEquals("addSection2 is wrong.", 1, editor.getScorecard().getNumberOfGroups()); assertEquals("addSection3 is wrong.", group1, editor.getScorecard().getGroup(0)); }
/** Tests resetName() method with accuracy state. */ public void testResetNameAccuracy() { editor.setName("crack"); assertEquals("setName is wrong.", "crack", editor.getScorecard().getName()); editor.resetName(); assertNull("setName is wrong.", editor.getScorecard().getName()); }
/** Tests resetVersion() method with accuracy state. */ public void testResetVersionAccuracy() { editor.setVersion("1.12"); assertEquals("resetVersion1 is wrong.", "1.12", editor.getScorecard().getVersion()); editor.resetVersion(); assertNull("resetVersion2 is wrong.", editor.getScorecard().getVersion()); }
/** Tests resetId() method with accuracy state. */ public void testResetIdAccuracy() { editor.setId(1234); assertEquals("setId is wrong.", 1234, editor.getScorecard().getId()); editor.resetId(); assertEquals("resetId is wrong.", -1, editor.getScorecard().getId()); }
/** Tests resetInUse() method with accuracy state. */ public void testResetInUseAccuracy() { assertFalse("isInUse is wrong.", editor.getScorecard().isInUse()); editor.setInUse(true); assertTrue("isInUse is wrong.", editor.getScorecard().isInUse()); editor.resetInUse(); assertFalse("isInUse is wrong.", editor.getScorecard().isInUse()); }
/** Tests addGroups(Group[] groups) method with accuracy state. */ public void testAddGroupsAccuracy() { assertEquals("addGroups1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); List ss = Arrays.asList(editor.getScorecard().getAllGroups()); assertTrue("addGroups2 is wrong.", ss.indexOf(group1) != -1); assertTrue("addGroups3 is wrong.", ss.indexOf(group2) != -1); }
/** Tests setScorecardType(ScorecardType scorecardType) method with accuracy state. */ public void testSetScorecardTypeAccuracy() { assertNull("resetScorecardType1 is wrong.", editor.getScorecard().getScorecardType()); ScorecardType newType = new ScorecardType(123); editor.setScorecardType(newType); assertEquals( "resetScorecardType2 is wrong.", newType, editor.getScorecard().getScorecardType()); }
/** Tests resetScorecardStatus() method with accuracy state. */ public void testResetScorecardStatusAccuracy() { assertNull("resetScorecardStatus1 is wrong.", editor.getScorecard().getScorecardStatus()); ScorecardStatus newStatus = new ScorecardStatus(123); editor.setScorecardStatus(newStatus); assertEquals( "resetScorecardStatus2 is wrong.", newStatus, editor.getScorecard().getScorecardStatus()); editor.resetScorecardStatus(); assertNull("resetScorecardStatus3 is wrong.", editor.getScorecard().getScorecardStatus()); }
/** Tests resetMaxScore() method with accuracy state. */ public void testResetMaxScoreAccuracy() { editor.setMaxScore(12.34f); assertEquals("resetMinScore1 is wrong.", 12.34f, editor.getScorecard().getMaxScore(), 0); editor.resetMaxScore(); try { editor.getScorecard().getMaxScore(); fail("getMaxScore is wrong."); } catch (IllegalStateException e) { // pass. } }
/** Tests getNumberOfGroups() method with accuracy state. */ public void testGetNumberOfGroupsAccuracy() { assertEquals("getNumberOfGroups1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); assertEquals("getNumberOfGroups2 is wrong.", 2, editor.getScorecard().getNumberOfGroups()); Group group3 = new Group(123); editor.addGroup(group3); assertEquals("getNumberOfGroups3 is wrong.", 3, editor.getScorecard().getNumberOfGroups()); }
/** Tests insertGroup(Group group, int index) method with accuracy state. */ public void testInsertGroupAccuracy() { assertEquals("insertGroup1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); assertEquals("insertGroup2 is wrong.", group2, editor.getScorecard().getGroup(1)); Group group3 = new Group(123); editor.insertGroup(group3, 1); assertEquals("insertGroup3 is wrong.", 3, editor.getScorecard().getNumberOfGroups()); assertEquals("insertGroup4 is wrong.", group3, editor.getScorecard().getGroup(1)); }
/** Tests resetCategory() method with accuracy state. */ public void testResetCategoryAccuracy() { editor.setCategory(12); assertEquals("resetCategory1 is wrong.", 12, editor.getScorecard().getCategory()); editor.resetCategory(); try { editor.getScorecard().getCategory(); fail("resetCategory2 is wrong."); } catch (IllegalStateException ise) { // ignore } catch (Exception e) { fail("resetCategory3 is wrong."); } }
/** Tests removeGroup(Group group) method with accuracy state. */ public void testRemoveGroupAccuracy() { assertEquals("removeGroup1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); List ss = Arrays.asList(editor.getScorecard().getAllGroups()); assertTrue("removeGroup2 is wrong.", ss.indexOf(group1) != -1); assertTrue("removeGroup3 is wrong.", ss.indexOf(group2) != -1); editor.removeGroup(group2); List ss2 = Arrays.asList(editor.getScorecard().getAllGroups()); assertEquals("removeGroup4 is wrong.", 1, ss2.size()); assertTrue("removeGroup5 is wrong.", ss2.indexOf(group1) != -1); assertTrue("removeGroup6 is wrong.", ss2.indexOf(group2) == -1); }
/** Tests removeGroups(Group[] groups) method with accuracy state. */ public void testRemoveGroupsAccuracy() { assertEquals("removeGroups1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); Group group3 = new Group(123); editor.addGroup(group3); assertEquals("removeGroups2 is wrong.", 3, editor.getScorecard().getNumberOfGroups()); editor.removeGroups(new Group[] {group1, group3}); assertEquals("removeGroups3 is wrong.", 1, editor.getScorecard().getNumberOfGroups()); assertEquals("removeGroups4 is wrong.", group2, editor.getScorecard().getGroup(0)); }
/** Tests checkWeights(float tolerance) method with accuracy state. */ public void testCheckWeightsAccuracy2() { editor.addGroups(groups); Group group3 = new Group(777779, "design method group2", 99.234f); editor.addGroup(group3); assertFalse("checkWeights is wrong", editor.getScorecard().checkWeights(0)); }
/** Tests getMaxScore() method with accuracy state. */ public void testGetMaxScoreAccuracy() { try { editor.getScorecard().getMaxScore(); fail("getMaxScore is wrong."); } catch (IllegalStateException e) { // pass. } }
/** Tests getAllGroups() method with accuracy state. */ public void testGetAllGroupsAccuracy() { assertEquals("getAllGroups1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); Group group3 = new Group(123); editor.addGroup(group3); Group[] ss = editor.getScorecard().getAllGroups(); assertEquals("getAllGroups1 is wrong.", 3, ss.length); List ss2 = Arrays.asList(ss); assertTrue("getAllGroups5 is wrong.", ss2.indexOf(group1) != -1); assertTrue("getAllGroups6 is wrong.", ss2.indexOf(group2) != -1); assertTrue("getAllGroups6 is wrong.", ss2.indexOf(group3) != -1); }
/** Tests removeGroup(int index) method with accuracy state. */ public void testRemoveGroup2Accuracy() { assertEquals("getNumberOfGroups1 is wrong.", 0, editor.getScorecard().getNumberOfGroups()); editor.addGroups(groups); Group group3 = new Group(123); editor.addGroup(group3); assertEquals("getNumberOfGroups2 is wrong.", 3, editor.getScorecard().getNumberOfGroups()); editor.removeGroup(1); assertEquals("getNumberOfGroups2 is wrong.", 2, editor.getScorecard().getNumberOfGroups()); List ss2 = Arrays.asList(editor.getScorecard().getAllGroups()); assertTrue("getAllGroups5 is wrong.", ss2.indexOf(group1) != -1); assertTrue("getAllGroups6 is wrong.", ss2.indexOf(group3) != -1); }
/** Tests getCategory() method with accuracy state. */ public void testGetCategoryAccuracy() { try { editor.getScorecard().getCategory(); fail("getCategory1 is wrong."); } catch (IllegalStateException ise) { // ignore } catch (Exception e) { fail("getCategory2 is wrong."); } }
/** Tests ScorecardEditor(Scorecard scorecard, String user) method with accuracy state. */ public void testScorecardEditorAccuracy2() { assertEquals("constructor is wrong.", "crackme", editor.getUser()); assertEquals("constructor is wrong.", card, editor.getScorecard()); }
/** Tests getScorecard() method with accuracy state. */ public void testGetScorecardAccuracy() { assertEquals("getScorecard is wrong.", card, editor.getScorecard()); }
/** Tests isInUse() method with accuracy state. */ public void testIsInUseAccuracy() { assertFalse("isInUse is wrong.", editor.getScorecard().isInUse()); }
/** Tests getScorecardStatus() method with accuracy state. */ public void testGetScorecardStatusAccuracy() { assertNull("getScorecardStatus is wrong.", editor.getScorecard().getScorecardStatus()); }
/** Tests getScorecardType() method with accuracy state. */ public void testGetScorecardTypeAccuracy() { assertNull("resetScorecardType1 is wrong.", editor.getScorecard().getScorecardType()); }
/** Tests checkWeights(float tolerance) method with accuracy state. */ public void testCheckWeightsAccuracy3() { editor.addGroups(groups); assertTrue("checkWeights is wrong", editor.getScorecard().checkWeights(0.08f)); }
/** Tests setCategory(long category) method with accuracy state. */ public void testSetCategoryAccuracy() { editor.setCategory(12); assertEquals("setCategory is wrong.", 12, editor.getScorecard().getCategory()); }
/** Tests setVersion(String version) method with accuracy state. */ public void testSetVersionAccuracy() { editor.setVersion("1.12"); assertEquals("setVersion is wrong.", "1.12", editor.getScorecard().getVersion()); }
/** Tests getVersion() method with accuracy state. */ public void testGetVersionAccuracy() { assertNull("getVersion is wrong.", editor.getScorecard().getVersion()); }
/** Tests setMaxScore(float maxScore) method with accuracy state. */ public void testSetMaxScoreAccuracy() { editor.setMaxScore(12.34f); assertEquals("setMinScore is wrong.", 12.34f, editor.getScorecard().getMaxScore(), 0); }