|
From: <rga...@us...> - 2002-11-22 21:22:12
|
Update of /cvsroot/csms/csms-core/src/test/src/org/fanfoot/scoring In directory sc8-pr-cvs1:/tmp/cvs-serv29250 Modified Files: TestScores.java Log Message: Now uses testEvents.html file from CVS (add additional tests in there) and the config files also come from CVS head. Index: TestScores.java =================================================================== RCS file: /cvsroot/csms/csms-core/src/test/src/org/fanfoot/scoring/TestScores.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestScores.java 10 Nov 2002 15:10:47 -0000 1.3 --- TestScores.java 22 Nov 2002 21:22:09 -0000 1.4 *************** *** 22,71 **** import org.custommonkey.xmlunit.XMLTestCase; import org.custommonkey.xmlunit.XMLUnit; ! /** ! * File <code>TestScores.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.TestScores ! * </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 09 November 2002 */ public class TestScores extends XMLTestCase { /** Instance of tested class. */ protected Scores varScores; ! String BBCTestScoringConfigURL = "file:///home/rgardler/projects/fanfoot/src/testcases/resources/conf/BBCTestScoringConfig.xsl"; java.util.logging.Logger logger = java.util.logging.Logger.getLogger( "org.fanfoot.scoring" ); --- 22,36 ---- import org.custommonkey.xmlunit.XMLTestCase; import org.custommonkey.xmlunit.XMLUnit; ! /* ! * @author rgardler ! * @created 09 November 2002 */ public class TestScores extends XMLTestCase { /** Instance of tested class. */ protected Scores varScores; ! String testScoringConfigURL = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/csms/csms-core/src/resources/conf/ScoringConfig.xsl?rev=HEAD"; ! String testEventsURL = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/csms/csms-core/src/test/resources/testHTML/testEvents.html?rev=HEAD&content-type=text/html"; ! String testEventsType = "BBC Text Commentary"; ! String testEventsConfigURL = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/csms/csms-core/src/resources/conf/footballEvents.xml?rev=HEAD&content-type=text/xml"; java.util.logging.Logger logger = java.util.logging.Logger.getLogger( "org.fanfoot.scoring" ); *************** *** 90,101 **** protected void setUp() { XMLUnit.setIgnoreWhitespace( true ); ! ! Events evts = new Events(); ! Event evt = new Event( "test1" ); ! evt.putPart( "part1", "value1" ); ! evts.add( evt ); ScoringConfiguration sc = new ScoringConfiguration( ! BBCTestScoringConfigURL ); try { --- 55,73 ---- protected void setUp() { XMLUnit.setIgnoreWhitespace( true ); ! EventParser ep = null; ! Events evts = null; ! try { ! ep = new EventParser( testEventsConfigURL ); ! } catch ( Exception e ) { ! fail( "Unable to create Event Parser: " + e.getMessage() ); ! } ! try { ! evts = ep.parse( testEventsURL, testEventsType ); ! } catch ( Exception e ) { ! fail( "Unable to parse events: " + e.getMessage() ); ! } ScoringConfiguration sc = new ScoringConfiguration( ! testScoringConfigURL ); try { *************** *** 108,144 **** /** - * for classes which doesn't contain any methods here is one - * additional method for performing test on such classes. - */ - public void testNoMethods() { - } - - - /** - * Method for testing how works original method: - * org.w3c.dom.Document calculate() from tested class - */ - public void testCalculate() { - }// end of testCalculate() - - - /** - * Method for testing how works original method: - * org.fanfoot.scoring.ScoringConfiguration getConfiguration() from - * tested class - */ - public void testGetConfiguration() { - }// end of testGetConfiguration() - - - /** - * Method for testing how works original method: - * org.fanfoot.scoring.Events getEvents() from tested class - */ - public void testGetEvents() { - }// end of testGetEvents() - - - /** * Method for testing how works original method: * org.w3c.dom.Document getScoresDocument() from tested class --- 80,83 ---- *************** *** 147,181 **** org.w3c.dom.Document doc = varScores.getScoresDocument(); try { ! logger.finest( "Scores XML is " + org.saafe.utils.XMLUtils.xmlToString( doc ) ); } catch ( Exception e ) { ! logger.warning( "Unable to convert scores doc to a string (for logging purposes): " + e ); // do nothing as this is nothing to do with the tests } } - - /** - * Method for testing how works original method: void - * setConfiguration(org.fanfoot.scoring.ScoringConfiguration) from - * tested class - */ - public void testSetConfiguration1814716963() { - }// end of testSetConfiguration1814716963(org.fanfoot.scoring.ScoringConfiguration) - - - /** - * Method for testing how works original method: void - * setEvents(org.fanfoot.scoring.Events) from tested class - */ - public void testSetEvents713640177() { - }// end of testSetEvents713640177(org.fanfoot.scoring.Events) - - - /** - * Method for testing how works original method: void - * setScoresDocument(org.w3c.dom.Document) from tested class - */ - public void testSetScoresDocument9554056() { - }// end of TestScores(String name) --- 86,98 ---- org.w3c.dom.Document doc = varScores.getScoresDocument(); try { ! logger.info( "Scores XML is " + org.saafe.utils.XMLUtils.xmlToString( doc ) ); ! assertNotNull( "Should have a scores document", doc ); ! assertEquals( "Docuemnt root incorrect", "scores", doc.getDocumentElement().getTagName() ); } catch ( Exception e ) { ! logger.warning( "Unable to convert scores doc to a string: " + e ); // do nothing as this is nothing to do with the tests } } |