From: <rh...@us...> - 2012-01-28 23:16:24
|
Revision: 19890 http://jmri.svn.sourceforge.net/jmri/?rev=19890&view=rev Author: rhwood Date: 2012-01-28 23:16:17 +0000 (Sat, 28 Jan 2012) Log Message: ----------- Silence two compiler warnings, three NetBeans editor warnings, and consistently indent. Modified Paths: -------------- trunk/jmri/java/test/jmri/jmrix/srcp/SRCPReplyTest.java Modified: trunk/jmri/java/test/jmri/jmrix/srcp/SRCPReplyTest.java =================================================================== --- trunk/jmri/java/test/jmri/jmrix/srcp/SRCPReplyTest.java 2012-01-28 22:13:55 UTC (rev 19889) +++ trunk/jmri/java/test/jmri/jmrix/srcp/SRCPReplyTest.java 2012-01-28 23:16:17 UTC (rev 19890) @@ -7,16 +7,16 @@ import jmri.jmrix.srcp.parser.SRCPClientParser; import jmri.jmrix.srcp.parser.ParseException; -import jmri.jmrix.srcp.parser.SimpleNode; import java.io.StringReader; /** * SRCPReplyTest.java * - * Description: tests for the jmri.jmrix.srcp.SRCPReply class - * @author Bob Jacobsen - * @version $Revision$ + * Description: tests for the jmri.jmrix.srcp.SRCPReply class + * + * @author Bob Jacobsen + * @version $Revision$ */ public class SRCPReplyTest extends TestCase { @@ -26,50 +26,53 @@ } // Test the string constructor. - public void testStringCtor(){ - String s=new String("100 OK REASON GOES HERE\n\r"); + public void testStringCtor() { + String s = "100 OK REASON GOES HERE\n\r"; SRCPReply m = new SRCPReply(s); Assert.assertNotNull(m); - Assert.assertTrue("String Constructor Correct",s.equals(m.toString())); + Assert.assertTrue("String Constructor Correct", s.equals(m.toString())); } // Test the parser constructor. - public void testParserCtor(){ - String s=new String("100 OK REASON GOES HERE\n\r"); + public void testParserCtor() { + String s = "100 OK REASON GOES HERE\n\r"; SRCPClientParser p = new SRCPClientParser(new StringReader(s)); SRCPReply m = null; - try { - m=new SRCPReply(p.inforesponse()); + try { + m = new SRCPReply(p.inforesponse()); } catch (ParseException pe) { - m=null; + // m is already null if there is an exception parsing the string } Assert.assertNotNull(m); - Assert.assertTrue("Parser Constructor Correct",s.equals(m.toString())); + Assert.assertTrue("Parser Constructor Correct", s.equals("" + m)); } + // from here down is testing infrastructure + public SRCPReplyTest(String s) { + super(s); + } - // from here down is testing infrastructure + // Main entry point + static public void main(String[] args) { + String[] testCaseName = {"-noloading", SRCPReplyTest.class.getName()}; + junit.swingui.TestRunner.main(testCaseName); + } - public SRCPReplyTest(String s) { - super(s); - } + // test suite from all defined tests + public static Test suite() { + TestSuite suite = new TestSuite(SRCPReplyTest.class); + return suite; + } - // Main entry point - static public void main(String[] args) { - String[] testCaseName = {"-noloading", SRCPReplyTest.class.getName()}; - junit.swingui.TestRunner.main(testCaseName); - } - - // test suite from all defined tests - public static Test suite() { - TestSuite suite = new TestSuite(SRCPReplyTest.class); - return suite; - } - // The minimal setup for log4J - protected void setUp() { apps.tests.Log4JFixture.setUp(); } - protected void tearDown() { apps.tests.Log4JFixture.tearDown(); } + @Override + protected void setUp() { + apps.tests.Log4JFixture.setUp(); + } + @Override + protected void tearDown() { + apps.tests.Log4JFixture.tearDown(); + } static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(SRCPReplyTest.class.getName()); - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |