From: Steve F. <sm...@us...> - 2002-08-10 20:56:54
|
Update of /cvsroot/mockobjects/no-stone-unturned/doc/xdocs In directory usw-pr-cvs1:/tmp/cvs-serv31674/doc/xdocs Modified Files: htmlbook.xsl how_mocks_happened.xml htmlbook.css Log Message: mostly formatting and layout Index: htmlbook.xsl =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/doc/xdocs/htmlbook.xsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- htmlbook.xsl 9 Aug 2002 23:48:20 -0000 1.6 +++ htmlbook.xsl 10 Aug 2002 20:56:50 -0000 1.7 @@ -6,8 +6,12 @@ <xsl:param name="use.extensions" select="'1'"/> <xsl:param name="html.stylesheet" select="'htmlbook.css'"/> + <xsl:param name="html.cleanup" select="1"/> <xsl:param name="callouts.extension" select="'1'"/> <xsl:param name="callout.defaultcolumn" select="'80'"/> + <xsl:param name="section.autolabel" select="0"/> + <xsl:param name="section.label.includes.component.label" select="0"/> + <xsl:param name="toc.section.depth">1</xsl:param> <xsl:template name="inline.gui"> <xsl:param name="content"> @@ -25,4 +29,10 @@ <xsl:call-template name="inline.gui"/> </xsl:template> + <xsl:param name="generate.toc"> + /book toc + /book/part toc + /article toc + chapter nop + </xsl:param> </xsl:stylesheet> Index: how_mocks_happened.xml =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/doc/xdocs/how_mocks_happened.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- how_mocks_happened.xml 10 Aug 2002 12:22:26 -0000 1.2 +++ how_mocks_happened.xml 10 Aug 2002 20:56:50 -0000 1.3 @@ -33,7 +33,7 @@ <programlisting> public class TestRobot { - [...] + &elipsis; public void setUp() { robot = new Robot(); } @@ -156,7 +156,6 @@ implementation still works despite the extensive refactorings I have performed. The first test is now:</para> -<example><title>Testing using a mock motor</title> <programlisting>public void testGotoSamePlace() { final Position POSITION = new Position(0, 0); robot.setCurrentPosition(POSITION); @@ -172,7 +171,6 @@ assertEquals("Should be same", POSITION, robot.getPosition()); }</programlisting> -</example> <para>In this test, if there is a bug in the Robot code and the Motor gets requested to move, the mock implementation of @@ -183,23 +181,20 @@ <para>Now I know that my Robot class works I can write a real implementation of the Motor interface:</para> -<example><title>A real implementation of the Motor interface</title> <programlisting> public class OneSpeedMotor implements Motor { public void move(MoveRequest request) { turnBy(request.getTurn()); advance(request.getDistance()); } - [...] + &elipsis; } </programlisting> -</example> <para>As my tests grow, I can refactor the various mock implementations into a single, more sophisticated MockMotor and use it throughout all the Robot tests; for example:</para> -<example><title>Creating a mock motor class</title> <programlisting>public void MockMotor implements Motor { private ArrayList expectedRequests = new ArrayList(); public void move(MoveRequest request) { @@ -214,13 +209,11 @@ assertEquals("Too few requests", 0, this.expectedRequests.size()); } }</programlisting> -</example> <para>Which makes our tests look like:</para> -<example><title>Testing our robot with mock motors</title> <programlisting>public class TestRobot { - [...] + &elipsis; static final Position ORIGIN = new Position(0, 0); public void setUp() { mockMotor = new MockMotor(); @@ -255,7 +248,6 @@ } } </programlisting> -</example> </section> <!-- Factoring out the motor --> @@ -274,7 +266,6 @@ distance a Robot travels, I can do so without changing the implementation of either the robot or its motor:</para> -<example><title>Tracking distance with the decorator pattern</title> <programlisting> /** A decorator that accumulates distances, then passes the request * on to a real Motor. @@ -300,10 +291,9 @@ OneSpeedMotor realMotor = new OneSpeedMotor(); MotorTracker motorTracker = new MotorTracker(realMotor); Robot = new Robot(motorTracker); -// do some travelling here [...] +// do some travelling here &elipsis; println("Total distance was: " + motorTracker.getTotalDistance()); </programlisting> -</example> <para>Neither changing the Motor implementation nor adding tracking functionality would have been so easy if I had stuck with a testing Index: htmlbook.css =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/doc/xdocs/htmlbook.css,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- htmlbook.css 9 Aug 2002 23:48:41 -0000 1.5 +++ htmlbook.css 10 Aug 2002 20:56:50 -0000 1.6 @@ -1,14 +1,15 @@ /* htmlbook.css, a stylesheet for htmlbook */ BODY { font-family: Arial, Helvetica, sans-serif} -h1 { font-family: Arial, Helvetica, sans-serif; margin-top: 5%; } -h2 { font-family: Arial, Helvetica, sans-serif; margin-top: 3%;} -h3 { font-family: Arial, Helvetica, sans-serif; font-style: italic; font-weight: bold} +H1 { margin-top: 5%; } +H2 { margin-top: 3%;} + +DIV.section H2 { font-style: italic; font-weight: normal; } +DIV.section H3 { font-style: normal; font-size: small; } .programlisting { margin-left: 5%; } .screen { margin-left: 5%; } -.sidebar { border: double black 1px; font-size: 80%; padding: 4px; text-align: center; - margin-left: 80%; } +.sidebar { border: double black 1px; font-size: 80%; padding: 4px; text-align: center; margin-left: 80%; } .screenshot { margin-left: 20%; } .caption { font-size: 80%; font-style: italic; } .guibutton { font-weight: bold; } |