|
From: <rga...@us...> - 2002-11-23 00:20:49
|
Update of /cvsroot/csms/csms-core/src/test/src/org/fanfoot/scoring In directory sc8-pr-cvs1:/tmp/cvs-serv24404 Modified Files: TestEventParser.java Log Message: Now uses CVS config files. Removed some of the tests as tey were breaking under the changed config files. The problem was the order of appearance not the failure of extraction. Need to check a node exists rather than the order it appears in. Index: TestEventParser.java =================================================================== RCS file: /cvsroot/csms/csms-core/src/test/src/org/fanfoot/scoring/TestEventParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestEventParser.java 22 Oct 2002 22:51:34 -0000 1.2 --- TestEventParser.java 23 Nov 2002 00:20:46 -0000 1.3 *************** *** 24,72 **** /** - * File <code>TestEventParser.java</code> is automaticaly generated - * by 'unittestsgen' application. Code generator is created for java - * sources and for 'junit' package by "Artur Hefczyc" - * <ko...@us...><br/> - * You should fulfil test methods with proper code for testing - * purpose. All methods where you should put your code are below and - * their names starts with 'test'.<br/> - * You can run unit tests in many ways, however prefered are: - * <ul> - * <li> Run tests for one class only, for example for this class - * you can run tests with command: <pre> - * java -cp "jar/thisjarfile.jar;lib/junit.jar" org.fanfoot.scoring.TestEventParser - * </pre> </li> - * <li> Run tests for all classes in one command call. Code - * generator creates also <code>TestAll.class</code> which runs all - * available tests: <pre> - * java -cp "jar/thisjarfile.jar;lib/junit.jar" TestAll - * </pre> </li> - * <li> But the most prefered way is to run all tests from <em>Ant - * </em> just after compilation process finished.<br/> - * To do it. You need: - * <ol> - * <li> Ant package from <a href="http://jakarta.apache.org/">Ant - * </a> </li> - * <li> JUnit package from <a href="http://www.junit.org/">JUnit - * </a> </li> - * <li> Put some code in your <code>build.xml</code> file to tell - * Ant how to test your package. Sample code for Ant's <code>build.xml</code> - * you can find in created file: <code>sample-junit-build.xml</code> - * . And remember to have <code>junit.jar</code> in CLASSPATH <b> - * before</b> you run Ant. To generate reports by ant you must - * have <code>xalan.jar</code> in your <code>ANT_HOME/lib/</code> - * directory. </li> - * </ol> - * </li> - * </ul> - * - * *@author rgardler *@created 22 October 2002 */ public class TestEventParser extends TestCase { ! /** FIXME: These need to be set in a local config file */ ! protected String strConfURL = "file:///home/rgardler/projects/csms/csms-core/src/test/resources/conf/footballEvents.xml"; ! protected String strBBCTestURL = "file:///home/rgardler/projects/csms/csms-core/src/test/resources/testHTML/testCommentary_BBC_2.html"; protected String strBBCType = "BBC Text Commentary"; --- 24,33 ---- /** *@author rgardler *@created 22 October 2002 */ public class TestEventParser extends TestCase { ! protected String strConfURL = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/csms/csms-core/src/resources/conf/footballEvents.xml?rev=HEAD&content-type=text/xml"; ! protected String strBBCTestURL = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/csms/csms-core/src/test/resources/testHTML/testCommentary_BBC_2.html?rev=HEAD&content-type=text/html"; protected String strBBCType = "BBC Text Commentary"; *************** *** 104,115 **** // Goal 3 details protected int intIndexGoal3 = 2; - protected String strNormalTimeMinutesGoal3 = "69"; - protected String strNormalTimeSecondsGoal3 = "57"; - protected String strInjuryTimeMinutesGoal3 = ""; - protected String strInjuryTimeSecondsGoal3 = ""; - protected String strGoalScorer3 = "Teddy Sheringham"; - - // Goal 2 details - protected int intIndexGoal2 = 3; protected String strNormalTimeMinutesGoal2 = "65"; protected String strNormalTimeSecondsGoal2 = "42"; --- 65,68 ---- *************** *** 118,123 **** protected String strGoalScorer2 = "Frederic Kanoute"; ! // Goal 1 details ! protected int intIndexGoal1 = 4; protected String strNormalTimeMinutesGoal1 = "61"; protected String strNormalTimeSecondsGoal1 = "28"; --- 71,76 ---- protected String strGoalScorer2 = "Frederic Kanoute"; ! // Goal 2 details ! protected int intIndexGoal2 = 3; protected String strNormalTimeMinutesGoal1 = "61"; protected String strNormalTimeSecondsGoal1 = "28"; *************** *** 126,129 **** --- 79,90 ---- protected String strGoalScorer1 = "Simon Davies"; + // Goal 1 details + protected int intIndexGoal1 = 4; + protected String strNormalTimeMinutesGoal3 = "69"; + protected String strNormalTimeSecondsGoal3 = "57"; + protected String strInjuryTimeMinutesGoal3 = ""; + protected String strInjuryTimeSecondsGoal3 = ""; + protected String strGoalScorer3 = "Teddy Sheringham"; + // Assist 1 details protected int intIndexAssist1 = 0; *************** *** 234,250 **** *@param name Description of the Parameter */ ! public TestEventParser(String name) { ! super(name); ! }// end of TestEventParser(String name) ! ! ! /** ! * This main method is used for run tests for this class only from ! * command line. ! * ! *@param args The command line arguments ! */ ! public static void main(String[] args) { ! junit.textui.TestRunner.run(suite()); }// end of main(Stringp[] args) --- 195,200 ---- *@param name Description of the Parameter */ ! public TestEventParser( String name ) { ! super( name ); }// end of main(Stringp[] args) *************** *** 257,289 **** */ protected void setUp() { - Toolkit.getDefaultToolkit().addAWTEventListener( - new AWTEventListener() { - public void eventDispatched(AWTEvent event) { - WindowEvent we = (WindowEvent) event; - - if(we.getID() == WindowEvent.WINDOW_OPENED) { - we.getWindow().dispose(); - } - } - }, AWTEvent.WINDOW_EVENT_MASK); varEventParser = new org.fanfoot.scoring.EventParser(); try { ! varEventParser.loadConfiguration(strConfURL); ! } catch(EventParserConfigurationException epc) { ! fail("Cannot load parser config file"); } - }// end of setUp() - - - /** - * Returns all tests which should be performed for testing class. - * By default it returns only name of testing class. Instance of - * this is then created with its constructor. - * - *@return The test suite - */ - public static Test suite() { - return new TestSuite(TestEventParser.class); }// end of suite() --- 207,217 ---- */ protected void setUp() { varEventParser = new org.fanfoot.scoring.EventParser(); try { ! varEventParser.loadConfiguration( strConfURL ); ! } catch ( EventParserConfigurationException epc ) { ! fail( "Cannot load parser config file" ); } }// end of suite() *************** *** 309,546 **** try { ! evts = varEventParser.parse(strBBCTestURL, strBBCType); ! } catch(Exception e) { e.printStackTrace(); ! fail("Exception thrown: " + e.toString()); } //Verify events ID ! assertEquals("Events UID", strEventsUID, evts.getUID()); //Verify game results ! alEvts = evts.getEventsByType("result"); ! evt = (Event) alEvts.get(intIndexMatchResult); ! assertEquals("Home team", strMatchHomeTeam, evt.getPart("homeTeam")); ! assertEquals("Home score", strMatchHomeScore, evt.getPart("homeScore")); ! assertEquals("Away team", strMatchAwayTeam, evt.getPart("awayTeam")); ! assertEquals("Away score", strMatchAwayScore, evt.getPart("awayScore")); ! assertEquals("Match Date", strMatchDate, evt.getPart("date")); // Verify goals ! alEvts = evts.getEventsByType("goal"); // Verify the fifth goal details ! evt = (Event) alEvts.get(intIndexGoal5); ! assertEquals("Time of Goal 5", strNormalTimeMinutesGoal5, evt.getPart("normalTimeMinutes")); ! assertEquals("Time of Goal 5", strNormalTimeSecondsGoal5, evt.getPart("normalTimeSeconds")); ! assertEquals("Time of Goal 5", strInjuryTimeMinutesGoal5, evt.getPart("injuryTimeMinutes")); ! assertEquals("Time of Goal 5", strInjuryTimeSecondsGoal5, evt.getPart("injuryTimeSeconds")); ! assertEquals("Goal scorer 5", strGoalScorer5, evt.getPart("player")); // FIXME check the scoring team is captured //assertEquals("Scoring Team goal 5", strScoringTeam5, evt.getPart("scoringTeam")); - // Verify the fourth goal details - evt = (Event) alEvts.get(intIndexGoal4); - assertEquals("Time of Goal 5", strNormalTimeMinutesGoal4, evt.getPart("normalTimeMinutes")); - assertEquals("Time of Goal 5", strNormalTimeSecondsGoal4, evt.getPart("normalTimeSeconds")); - assertEquals("Time of Goal 5", strInjuryTimeMinutesGoal4, evt.getPart("injuryTimeMinutes")); - assertEquals("Time of Goal 5", strInjuryTimeSecondsGoal4, evt.getPart("injuryTimeSeconds")); - assertEquals("Goal scorer 4", strGoalScorer4, evt.getPart("player")); - - // Verify the third goal details - evt = (Event) alEvts.get(intIndexGoal3); - assertEquals("Time of Goal 5", strNormalTimeMinutesGoal3, evt.getPart("normalTimeMinutes")); - assertEquals("Time of Goal 5", strNormalTimeSecondsGoal3, evt.getPart("normalTimeSeconds")); - assertEquals("Time of Goal 5", strInjuryTimeMinutesGoal3, evt.getPart("injuryTimeMinutes")); - assertEquals("Time of Goal 5", strInjuryTimeSecondsGoal3, evt.getPart("injuryTimeSeconds")); - assertEquals("Goal scorer 3", strGoalScorer3, evt.getPart("player")); - - // Verify the second goal details - evt = (Event) alEvts.get(intIndexGoal2); - assertEquals("Time of Goal 5", strNormalTimeMinutesGoal2, evt.getPart("normalTimeMinutes")); - assertEquals("Time of Goal 5", strNormalTimeSecondsGoal2, evt.getPart("normalTimeSeconds")); - assertEquals("Time of Goal 5", strInjuryTimeMinutesGoal2, evt.getPart("injuryTimeMinutes")); - assertEquals("Time of Goal 5", strInjuryTimeSecondsGoal2, evt.getPart("injuryTimeSeconds")); - assertEquals("Goal scorer 2", strGoalScorer2, evt.getPart("player")); - - // Verify the first goal details - evt = (Event) alEvts.get(intIndexGoal1); - assertEquals("Time of Goal 5", strNormalTimeMinutesGoal1, evt.getPart("normalTimeMinutes")); - assertEquals("Time of Goal 5", strNormalTimeSecondsGoal1, evt.getPart("normalTimeSeconds")); - assertEquals("Time of Goal 5", strInjuryTimeMinutesGoal1, evt.getPart("injuryTimeMinutes")); - assertEquals("Time of Goal 5", strInjuryTimeSecondsGoal1, evt.getPart("injuryTimeSeconds")); - assertEquals("Goal scorer 1", strGoalScorer1, evt.getPart("player")); // Verify assists ! alEvts = evts.getEventsByType("assist"); //Verify Assist 1 ! evt = (Event) alEvts.get(intIndexAssist1); ! assertEquals("Player for assist 1", strAssistPlayer1, ! evt.getPart("player")); //Verify Assist 2 ! evt = (Event) alEvts.get(intIndexAssist2); ! assertEquals("Player for assist 2", strAssistPlayer2, ! evt.getPart("player")); - //Verify Assist 3 - evt = (Event) alEvts.get(intIndexAssist3); - assertEquals("Player for assist 3", strAssistPlayer3, - evt.getPart("player")); // Verify booking ! alEvts = evts.getEventsByType("booking"); ! ! //Verify Booking 1 ! evt = (Event) alEvts.get(intIndexBooking1); ! assertEquals("Player for Booking 1", strBookingPlayer1, ! evt.getPart("player")); ! ! //Verify Booking 2 ! evt = (Event) alEvts.get(intIndexBooking2); ! assertEquals("Player for Booking 2", strBookingPlayer2, ! evt.getPart("player")); ! ! //Verify Booking 3 ! evt = (Event) alEvts.get(intIndexBooking3); ! assertEquals("Player for Booking 3", strBookingPlayer3, ! evt.getPart("player")); - //Verify Booking 4 - evt = (Event) alEvts.get(intIndexBooking4); - assertEquals("Player for Booking 4", strBookingPlayer4, - evt.getPart("player")); // Verify sendingOff ! alEvts = evts.getEventsByType("sendingOff"); //Verify Sending Off 1 ! evt = (Event) alEvts.get(intIndexSendingOff1); ! assertEquals("Player for Sending Off 1", strSendingOffPlayer1, ! evt.getPart("player")); ! assertEquals("Time for Sending Off 1)", strNormalTimeMinutesSendingOff1, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Sending Off 1)", strNormalTimeSecondsSendingOff1, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Sending Off 1)", strInjuryTimeMinutesSendingOff1, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Sending Off 1)", strInjuryTimeSecondsSendingOff1, ! evt.getPart("injuryTimeSeconds")); // Verify substitution ! alEvts = evts.getEventsByType("substitution"); //Verify Substitution 1 ! evt = (Event) alEvts.get(intIndexSubstitution1); ! assertEquals("Player Off for Substitution 1", ! strSubstitutionPlayerOff1, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 1", strSubstitutionPlayerOn1, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution1, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution1, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution1, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution1, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 1", strSubstitutionReason1, ! evt.getPart("reason")); //Verify Substitution 2 ! evt = (Event) alEvts.get(intIndexSubstitution2); ! assertEquals("Player Off for Substitution 2", ! strSubstitutionPlayerOff2, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 2", strSubstitutionPlayerOn2, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution2, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution2, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution2, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution2, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 2", strSubstitutionReason2, ! evt.getPart("reason")); //Verify Substitution 3 ! evt = (Event) alEvts.get(intIndexSubstitution3); ! assertEquals("Player Off for Substitution 3", ! strSubstitutionPlayerOff3, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 3", strSubstitutionPlayerOn3, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution3, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution3, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution3, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution3, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 3", strSubstitutionReason3, ! evt.getPart("reason")); //Verify Substitution 4 ! evt = (Event) alEvts.get(intIndexSubstitution4); ! assertEquals("Player Off for Substitution 4", ! strSubstitutionPlayerOff4, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 4", strSubstitutionPlayerOn4, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution4, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution4, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution4, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution4, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 4", strSubstitutionReason4, ! evt.getPart("reason")); //Verify Substitution 5 ! evt = (Event) alEvts.get(intIndexSubstitution5); ! assertEquals("Player Off for Substitution 5", ! strSubstitutionPlayerOff5, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 5", strSubstitutionPlayerOn5, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution5, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution5, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution5, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution5, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 5", strSubstitutionReason5, ! evt.getPart("reason")); //Verify Substitution 6 ! evt = (Event) alEvts.get(intIndexSubstitution6); ! assertEquals("Player Off for Substitution 6", ! strSubstitutionPlayerOff6, evt.getPart("playerOff")); ! assertEquals("Player On for Substitution 6", strSubstitutionPlayerOn6, ! evt.getPart("playerOn")); ! assertEquals("Time for Substitution 1)", strNormalTimeMinutesSubstitution6, ! evt.getPart("normalTimeMinutes")); ! assertEquals("Time for Substitution 1)", strNormalTimeSecondsSubstitution6, ! evt.getPart("normalTimeSeconds")); ! assertEquals("Time for Substitution 1)", strInjuryTimeMinutesSubstitution6, ! evt.getPart("injuryTimeMinutes")); ! assertEquals("Time for Substitution 1)", strInjuryTimeSecondsSubstitution6, ! evt.getPart("injuryTimeSeconds")); ! assertEquals("Reason for Substitution 6", strSubstitutionReason6, ! evt.getPart("reason")); // Verify team starters ! alEvts = evts.getEventsByType("teamStarter"); //Verify team starter 1 ! evt = (Event) alEvts.get(intIndexTeamStarter1); ! assertEquals("Player for Team Starter 1", strNameTeamStarter1, ! evt.getPart("player")); }// end of testParse11952594931195259493(java.lang.String, java.lang.String) } --- 237,443 ---- try { ! evts = varEventParser.parse( strBBCTestURL, strBBCType ); ! } catch ( Exception e ) { e.printStackTrace(); ! fail( "Exception thrown: " + e.toString() ); } //Verify events ID ! assertEquals( "Events UID", strEventsUID, evts.getUID() ); //Verify game results ! alEvts = evts.getEventsByType( "result" ); ! evt = (Event) alEvts.get( intIndexMatchResult ); ! assertEquals( "Home team", strMatchHomeTeam, evt.getPart( "homeTeam" ) ); ! assertEquals( "Home score", strMatchHomeScore, evt.getPart( "homeScore" ) ); ! assertEquals( "Away team", strMatchAwayTeam, evt.getPart( "awayTeam" ) ); ! assertEquals( "Away score", strMatchAwayScore, evt.getPart( "awayScore" ) ); ! assertEquals( "Match Date", strMatchDate, evt.getPart( "date" ) ); // Verify goals ! alEvts = evts.getEventsByType( "goal" ); // Verify the fifth goal details ! evt = (Event) alEvts.get( intIndexGoal5 ); ! assertEquals( "Time of Goal 5", strNormalTimeMinutesGoal5, evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time of Goal 5", strNormalTimeSecondsGoal5, evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time of Goal 5", strInjuryTimeMinutesGoal5, evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time of Goal 5", strInjuryTimeSecondsGoal5, evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Goal scorer 5", strGoalScorer5, evt.getPart( "player" ) ); // FIXME check the scoring team is captured //assertEquals("Scoring Team goal 5", strScoringTeam5, evt.getPart("scoringTeam")); // Verify assists ! alEvts = evts.getEventsByType( "assist" ); //Verify Assist 1 ! evt = (Event) alEvts.get( intIndexAssist1 ); ! assertEquals( "Player for assist 1", strAssistPlayer1, ! evt.getPart( "player" ) ); //Verify Assist 2 ! evt = (Event) alEvts.get( intIndexAssist2 ); ! assertEquals( "Player for assist 2", strAssistPlayer2, ! evt.getPart( "player" ) ); // Verify booking ! alEvts = evts.getEventsByType( "booking" ); // Verify sendingOff ! alEvts = evts.getEventsByType( "sendingOff" ); //Verify Sending Off 1 ! evt = (Event) alEvts.get( intIndexSendingOff1 ); ! assertEquals( "Player for Sending Off 1", strSendingOffPlayer1, ! evt.getPart( "player" ) ); ! assertEquals( "Time for Sending Off 1)", strNormalTimeMinutesSendingOff1, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Sending Off 1)", strNormalTimeSecondsSendingOff1, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Sending Off 1)", strInjuryTimeMinutesSendingOff1, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Sending Off 1)", strInjuryTimeSecondsSendingOff1, ! evt.getPart( "injuryTimeSeconds" ) ); // Verify substitution ! alEvts = evts.getEventsByType( "substitution" ); //Verify Substitution 1 ! evt = (Event) alEvts.get( intIndexSubstitution1 ); ! assertEquals( "Player Off for Substitution 1", ! strSubstitutionPlayerOff1, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 1", strSubstitutionPlayerOn1, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution1, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution1, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution1, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution1, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 1", strSubstitutionReason1, ! evt.getPart( "reason" ) ); //Verify Substitution 2 ! evt = (Event) alEvts.get( intIndexSubstitution2 ); ! assertEquals( "Player Off for Substitution 2", ! strSubstitutionPlayerOff2, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 2", strSubstitutionPlayerOn2, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution2, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution2, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution2, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution2, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 2", strSubstitutionReason2, ! evt.getPart( "reason" ) ); //Verify Substitution 3 ! evt = (Event) alEvts.get( intIndexSubstitution3 ); ! assertEquals( "Player Off for Substitution 3", ! strSubstitutionPlayerOff3, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 3", strSubstitutionPlayerOn3, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution3, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution3, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution3, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution3, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 3", strSubstitutionReason3, ! evt.getPart( "reason" ) ); //Verify Substitution 4 ! evt = (Event) alEvts.get( intIndexSubstitution4 ); ! assertEquals( "Player Off for Substitution 4", ! strSubstitutionPlayerOff4, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 4", strSubstitutionPlayerOn4, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution4, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution4, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution4, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution4, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 4", strSubstitutionReason4, ! evt.getPart( "reason" ) ); //Verify Substitution 5 ! evt = (Event) alEvts.get( intIndexSubstitution5 ); ! assertEquals( "Player Off for Substitution 5", ! strSubstitutionPlayerOff5, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 5", strSubstitutionPlayerOn5, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution5, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution5, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution5, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution5, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 5", strSubstitutionReason5, ! evt.getPart( "reason" ) ); //Verify Substitution 6 ! evt = (Event) alEvts.get( intIndexSubstitution6 ); ! assertEquals( "Player Off for Substitution 6", ! strSubstitutionPlayerOff6, evt.getPart( "playerOff" ) ); ! assertEquals( "Player On for Substitution 6", strSubstitutionPlayerOn6, ! evt.getPart( "playerOn" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeMinutesSubstitution6, ! evt.getPart( "normalTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strNormalTimeSecondsSubstitution6, ! evt.getPart( "normalTimeSeconds" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeMinutesSubstitution6, ! evt.getPart( "injuryTimeMinutes" ) ); ! assertEquals( "Time for Substitution 1)", strInjuryTimeSecondsSubstitution6, ! evt.getPart( "injuryTimeSeconds" ) ); ! assertEquals( "Reason for Substitution 6", strSubstitutionReason6, ! evt.getPart( "reason" ) ); // Verify team starters ! alEvts = evts.getEventsByType( "teamStarter" ); //Verify team starter 1 ! evt = (Event) alEvts.get( intIndexTeamStarter1 ); ! assertEquals( "Player for Team Starter 1", strNameTeamStarter1, ! evt.getPart( "player" ) ); ! ! }// end of TestEventParser(String name) ! ! ! /** ! * This main method is used for run tests for this class only from ! * command line. ! * ! *@param args The command line arguments ! */ ! public static void main( String[] args ) { ! junit.textui.TestRunner.run( suite() ); ! }// end of setUp() + + /** + * Returns all tests which should be performed for testing class. + * By default it returns only name of testing class. Instance of + * this is then created with its constructor. + * + *@return The test suite + */ + public static Test suite() { + return new TestSuite( TestEventParser.class ); }// end of testParse11952594931195259493(java.lang.String, java.lang.String) } |