diff options
author | mcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-03 15:07:30 +0000 |
---|---|---|
committer | mcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-03 15:07:30 +0000 |
commit | 253062aa74221110a7ec0d95ef87bd49678dd9a4 (patch) | |
tree | d474e650f3eec9dd26619ea1d46b61e8a67eb15f /java/sca/modules | |
parent | 90e86bc496ee79d79af8e9ab8587d71cb4534c26 (diff) |
Converted unit tests from JUnit 3 to JUnit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@722922 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
4 files changed, 42 insertions, 18 deletions
diff --git a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java index 14b0577f65..779cbb2ba3 100644 --- a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java +++ b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java @@ -18,12 +18,13 @@ */ package org.apache.tuscany.sca.interfacedef.java.impl; +import static org.junit.Assert.assertEquals; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import junit.framework.Assert; -import junit.framework.TestCase; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Interface; @@ -35,6 +36,7 @@ import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.junit.Test; import org.osoa.sca.annotations.Remotable; /** @@ -43,13 +45,14 @@ import org.osoa.sca.annotations.Remotable; * * @version $Rev$ $Date$ */ -public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { +public class JavaInterfaceUtilDuplicateRemotableTestCase { /** * Test to get the getTime() method from the LocalTimeService * * @throws Exception Test failed */ + @Test public void testLocalTimeServiceGetTime() throws Exception { doTestLocalTimeServiceGetTime(LocalTimeService.class); } @@ -75,6 +78,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * @throws Exception Test failed */ + @Test public void testWorldTimeServiceGetTime() throws Exception { doTestWorldTimeServiceGetTime(WorldTimeService.class); } @@ -101,6 +105,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * @throws Exception Test failed */ + @Test public void testGMTTimeServiceGetTime() throws Exception { doTestGMTTimeServiceGetTime(GMTTimeService.class); } @@ -129,6 +134,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * @throws Exception Test failed */ + @Test public void testLocalTimeServiceGetTimeFromTimeServiceImpl() throws Exception { doTestLocalTimeServiceGetTime(TimeServiceImpl.class); } @@ -139,6 +145,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * @throws Exception Test failed */ + @Test public void testWorldTimeServiceGetTimeFromTimeServiceImpl() throws Exception { doTestWorldTimeServiceGetTime(TimeServiceImpl.class); } @@ -148,6 +155,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * @throws Exception Test failed */ + @Test public void testGMTTimeServiceGetTimeFromTimeServiceImpl() throws Exception { doTestGMTTimeServiceGetTime(TimeServiceImpl.class); } @@ -189,6 +197,7 @@ public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase { * * This test case is for TUSCANY-2194 */ + @Test public void testDuplicateOpeartionOnRemotableInterface() { JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(); diff --git a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java index 66f98adce3..86a38fa0c4 100644 --- a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java +++ b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java @@ -19,24 +19,26 @@ package org.apache.tuscany.sca.interfacedef.java.impl; import static org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil.findOperation; +import static org.junit.Assert.assertEquals; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import junit.framework.TestCase; - import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; +import org.junit.Before; +import org.junit.Test; /** * @version $Rev$ $Date$ */ -public class JavaInterfaceUtilTestCase extends TestCase { +public class JavaInterfaceUtilTestCase { private List<Operation> operations; + @Test public void testNoParamsFindOperation() throws Exception { Method method = Foo.class.getMethod("foo"); Operation ret = findOperation(method, operations); @@ -44,6 +46,7 @@ public class JavaInterfaceUtilTestCase extends TestCase { assertEquals(0, method.getParameterTypes().length); } + @Test public void testParamsFindOperation() throws Exception { Method method = Foo.class.getMethod("foo", String.class); Operation ret = findOperation(method, operations); @@ -51,16 +54,15 @@ public class JavaInterfaceUtilTestCase extends TestCase { assertEquals(String.class, method.getParameterTypes()[0]); } + @Test public void testPrimitiveParamFindOperation() throws NoSuchMethodException { Method method = Foo.class.getMethod("foo", Integer.TYPE); Operation operation = findOperation(method, operations); assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical()); } - @Override - protected void setUp() throws Exception { - super.setUp(); - + @Before + public void setUp() throws Exception { Operation operation = newOperation("foo"); List<DataType> types = new ArrayList<DataType>(); DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types); diff --git a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java index f90a5cb8a1..2a2b7800db 100644 --- a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java +++ b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java @@ -18,7 +18,11 @@ */ package org.apache.tuscany.sca.interfacedef.java.introspection.impl; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.Interface; @@ -26,17 +30,19 @@ import org.apache.tuscany.sca.interfacedef.InvalidOperationException; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.junit.Before; +import org.junit.Test; import org.osoa.sca.annotations.Conversational; import org.osoa.sca.annotations.EndsConversation; /** * @version $Rev$ $Date$ */ -public class ConversationalIntrospectionTestCase extends TestCase { +public class ConversationalIntrospectionTestCase { private JavaInterfaceFactory javaFactory; - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { javaFactory = new DefaultJavaInterfaceFactory(); } @@ -49,6 +55,7 @@ public class ConversationalIntrospectionTestCase extends TestCase { return null; } + @Test public void testServiceContractConversationalInformationIntrospection() throws Exception { Interface i = javaFactory.createJavaInterface(Foo.class); assertNotNull(i); @@ -59,6 +66,7 @@ public class ConversationalIntrospectionTestCase extends TestCase { assertEquals(ConversationSequence.CONVERSATION_END, seq); } + @Test public void testBadServiceContract() throws Exception { try { javaFactory.createJavaInterface(BadFoo.class); @@ -68,6 +76,7 @@ public class ConversationalIntrospectionTestCase extends TestCase { } } + @Test public void testNonConversationalInformationIntrospection() throws Exception { Interface i = javaFactory.createJavaInterface(NonConversationalFoo.class); assertFalse(i.isConversational()); diff --git a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java index 5a454f176c..1a0351fafa 100644 --- a/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java +++ b/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java @@ -18,23 +18,26 @@ */ package org.apache.tuscany.sca.interfacedef.java.introspection.impl; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor; import org.apache.tuscany.sca.policy.DefaultPolicyFactory; +import org.junit.Before; +import org.junit.Test; import org.osoa.sca.annotations.PolicySets; import org.osoa.sca.annotations.Requires; /** * @version $Rev$ $Date$ */ -public class PolicyProcessorTestCase extends TestCase { +public class PolicyProcessorTestCase { private JavaInterfaceFactory factory = new DefaultJavaInterfaceFactory(); private PolicyJavaInterfaceVisitor policyProcessor; + @Test public void testInterfaceLevel() throws Exception { JavaInterface type = factory.createJavaInterface(Interface1.class); policyProcessor.visitInterface(type); @@ -42,6 +45,7 @@ public class PolicyProcessorTestCase extends TestCase { assertEquals(1, type.getPolicySets().size()); } + @Test public void testMethodLevel() throws Exception { JavaInterface type = factory.createJavaInterface(Interface2.class); policyProcessor.visitInterface(type); @@ -53,6 +57,7 @@ public class PolicyProcessorTestCase extends TestCase { assertEquals(1, type.getOperations().get(1).getPolicySets().size()); } + @Test public void testInterfaceAndMethodLevel() throws Exception { JavaInterface type = factory.createJavaInterface(Interface3.class); policyProcessor.visitInterface(type); @@ -64,9 +69,8 @@ public class PolicyProcessorTestCase extends TestCase { assertEquals(1, type.getOperations().get(1).getPolicySets().size()); } - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { policyProcessor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory()); } |