diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-14 23:03:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-14 23:03:37 +0000 |
commit | aacaafaf868d561abcb37f7571614f3e082b9113 (patch) | |
tree | bd2f94a3da59ecef25ab38d82d61269c7224e46b | |
parent | 5b0fe621f31dd2ed27a24e9909547a406185f704 (diff) |
Update test case to JUNIT 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@704734 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | branches/sca-equinox/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/branches/sca-equinox/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java b/branches/sca-equinox/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java index 8e4d30e7a0..8e37465039 100644 --- a/branches/sca-equinox/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java +++ b/branches/sca-equinox/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java @@ -19,20 +19,25 @@ package org.apache.tuscany.sca.workspace.xml; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.StringReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import junit.framework.TestCase; - import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.workspace.Workspace; +import org.junit.BeforeClass; +import org.junit.Test; /** * Test the workspace processor. @@ -40,34 +45,34 @@ import org.apache.tuscany.sca.workspace.Workspace; * @version $Rev$ $Date$ */ -public class ContributionWorkspaceProcessorTestCase extends TestCase { +public class ContributionWorkspaceProcessorTestCase { private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">" + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">" + "<contribution uri=\"uri1\" location=\"location1\"/>" + "<contribution uri=\"uri2\" location=\"location2\"/>" + "</workspace>"; private static final String INVALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">" + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">" + "<contribution uri=\"uri1\" location=\"location1\"/>" + "<contribution uri=\"uri2\" location=\"location2\"/>" + "</contribution>" + "</workspace>"; - private XMLInputFactory inputFactory; - private StAXArtifactProcessor<Object> staxProcessor; + private static XMLInputFactory inputFactory; + private static StAXArtifactProcessor<Object> staxProcessor; - @Override - protected void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); + StAXArtifactProcessorExtensionPoint staxProcessors = + new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); } + @Test public void testRead() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML)); Workspace workspace = (Workspace)staxProcessor.read(reader); @@ -75,8 +80,9 @@ public class ContributionWorkspaceProcessorTestCase extends TestCase { assertEquals(2, workspace.getContributions().size()); assertEquals("uri2", workspace.getContributions().get(1).getURI()); assertEquals("location2", workspace.getContributions().get(1).getLocation()); - } + } + @Test public void testReadInvalid() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML)); try { |