From c8fc7a480d02983a7507f4792366e156b24f5b8d Mon Sep 17 00:00:00 2001 From: Maxime Sinclair Date: Fri, 8 Apr 2011 12:58:56 +0200 Subject: [PATCH] AsciiArt unit test addition. --- .../plantuml/servlet/AllTests.java | 1 + .../plantuml/servlet/TestAsciiArt.java | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java diff --git a/test/src/net/sourceforge/plantuml/servlet/AllTests.java b/test/src/net/sourceforge/plantuml/servlet/AllTests.java index ece24b5..dab16b9 100644 --- a/test/src/net/sourceforge/plantuml/servlet/AllTests.java +++ b/test/src/net/sourceforge/plantuml/servlet/AllTests.java @@ -10,6 +10,7 @@ public class AllTests extends TestSuite { //$JUnit-BEGIN$ suite.addTestSuite(TestForm.class); suite.addTestSuite(TestImage.class); + suite.addTestSuite(TestAsciiArt.class); suite.addTestSuite(TestProxy.class); //$JUnit-END$ return suite; diff --git a/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java b/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java new file mode 100644 index 0000000..d9fbe8f --- /dev/null +++ b/test/src/net/sourceforge/plantuml/servlet/TestAsciiArt.java @@ -0,0 +1,28 @@ +package net.sourceforge.plantuml.servlet; + +import junit.framework.TestCase; +import com.meterware.httpunit.*; + +import java.util.Date; +import java.util.Locale; +import java.text.SimpleDateFormat; + +public class TestAsciiArt extends TestCase { + /** + * Verifies the generation of the ascii art for the Bob -> Alice sample + */ + public void testSimpleSequenceDiagram() throws Exception { + WebConversation conversation = new WebConversation(); + WebRequest request = new GetMethodWebRequest( TestUtils.getServerUrl()+"txt/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); + WebResponse response = conversation.getResource( request); + // Analyze response + // Verifies the Content-Type header + assertEquals( "Response content type is not TEXT PLAIN", "text/plain", response.getContentType()); + // Get the content and verify its size + String diagram = response.getText(); + int diagramLen = diagram.length(); + assertTrue( diagramLen > 200); + assertTrue( diagramLen < 250); + } + +}