Re: [xwiki-devs] [xwiki-notifications] r22458 - in platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-equation/src/test: java/org/xwiki/rendering resources
On Aug 10, 2009, at 11:41 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2009-08-10 11:41:27 +0200 (Mon, 10 Aug 2009) New Revision: 22458
Added: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/macroequation1.test Removed: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/macromessage1.test Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/java/org/xwiki/rendering/ RenderingTests.java Log: XWIKI-4139: New {{equation}} macro for displaying mathematical expressions Adding a simple test
Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/ xwiki-rendering-macro-equation/src/test/java/org/xwiki/rendering/ RenderingTests.java =================================================================== --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/java/org/xwiki/rendering/ RenderingTests.java 2009-08-10 09:03:24 UTC (rev 22457) +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/java/org/xwiki/rendering/ RenderingTests.java 2009-08-10 09:41:27 UTC (rev 22458) @@ -45,7 +45,7 @@ { RenderingTestSuite suite = new RenderingTestSuite("Test Equation Macro");
- suite.addTestsFromResource("macromessage1", true); + suite.addTestsFromResource("macroequation1", true);
ComponentManagerTestSetup testSetup = new ComponentManagerTestSetup(suite); setUpMocks(testSetup.getComponentManager()); @@ -80,16 +80,16 @@ context.checking(new Expectations() { { - oneOf(mockDocumentAccessBridge).getURL(null, "tex", null, null); + atLeast(2).of(mockDocumentAccessBridge).getURL(null, "tex", null, null);
are 2 calls really part of the contract? If you don't need to test the number of calls you should use allow(). -Vincent
will(returnValue("/xwiki/bin/view/Main/"));
- oneOf(mockConfiguration).getRenderer(); + atLeast(2).of(mockConfiguration).getRenderer(); will(returnValue("snuggletex"));
- oneOf(mockImageStorage).get(with(any(String.class))); - will(returnValue(false)); + atLeast(2).of(mockImageStorage).get(with(any(String.class))); + will(returnValue(null));
- oneOf(mockImageStorage).put(with(any(String.class)), with(any(ImageData.class))); + atLeast(2).of(mockImageStorage).put(with(any(String.class)), with(any(ImageData.class))); } }); }
Copied: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/ xwiki-rendering-macro-equation/src/test/resources/ macroequation1.test (from rev 22456, platform/core/trunk/xwiki- rendering/xwiki-rendering-macros/xwiki-rendering-macro-equation/src/ test/resources/macromessage1.test) =================================================================== --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/ macroequation1.test (rev 0) +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/macroequation1.test 2009-08-10 09:41:27 UTC (rev 22458) @@ -0,0 +1,18 @@ +.#----------------------------------------------------- +.input|xwiki/2.0 +.#----------------------------------------------------- +{{equation}}a+b{{/equation}} +.#----------------------------------------------------- +.expect|event/1.0 +.#----------------------------------------------------- +beginDocument +beginMacroMarkerStandalone [equation] [] [a+b] +beginParagraph +onImage: [/xwiki/bin/view/Main// 06fbba0acf130efd9e147fdfe91a943cc4f3e29972c6cd1d972e9aabf0900966] [false] [[alt]=[a+b]] +endParagraph +endMacroMarkerStandalone [equation] [] [a+b] +endDocument +.#----------------------------------------------------- +.expect|xwiki/2.0 +.#----------------------------------------------------- +{{equation}}a+b{{/equation}}
Deleted: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/ xwiki-rendering-macro-equation/src/test/resources/macromessage1.test =================================================================== --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/macromessage1.test 2009-08-10 09:03:24 UTC (rev 22457) +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki- rendering-macro-equation/src/test/resources/macromessage1.test 2009-08-10 09:41:27 UTC (rev 22458) @@ -1,17 +0,0 @@ -.#----------------------------------------------------- -.input|xwiki/2.0 -.#----------------------------------------------------- -{{equation}}a+b{{/equation}} -.#----------------------------------------------------- -.expect|event/1.0 -.#----------------------------------------------------- -beginDocument -beginMacroMarkerStandalone [equation] [] [a+b] -beginParagraph -endParagraph -endMacroMarkerStandalone [equation] [] [a+b] -endDocument -.#----------------------------------------------------- -.expect|xwiki/2.0 -.#----------------------------------------------------- -{{equation}}a+b{{/equation}}
Vincent Massol wrote:
On Aug 10, 2009, at 11:41 AM, sdumitriu (SVN) wrote:
- oneOf(mockDocumentAccessBridge).getURL(null, "tex", null, null); + atLeast(2).of(mockDocumentAccessBridge).getURL(null, "tex", null, null);
are 2 calls really part of the contract? If you don't need to test the number of calls you should use allow().
I'm still learning the new JMock... Thanks for the tip -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Sergiu Dumitriu -
Vincent Massol