summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/interface
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 15:01:06 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 15:01:06 +0000
commit90e86bc496ee79d79af8e9ab8587d71cb4534c26 (patch)
tree5f0c9f29c10f6e364ef1dbd5afb524243442135d /java/sca/modules/interface
parent82de12de0ee327ab007495aae903cac23a0e124e (diff)
Converted unit tests from JUnit 3 to JUnit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@722917 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/interface')
-rw-r--r--java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java27
1 files changed, 21 insertions, 6 deletions
diff --git a/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
index 269a3dc038..acdaae799e 100644
--- a/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
+++ b/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
@@ -18,14 +18,14 @@
*/
package org.apache.tuscany.sca.interfacedef.impl;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
@@ -35,29 +35,33 @@ import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.Operation;
+import org.junit.Before;
+import org.junit.Test;
/**
* TODO some tests commented out due to DataType.equals() needing to be strict
*
* @version $Rev$ $Date$
*/
-public class ContractCompatibilityTestCase extends TestCase {
+public class ContractCompatibilityTestCase {
private InterfaceContractMapper mapper;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
mapper = utilities.getUtility(InterfaceContractMapper.class);
}
+ @Test
public void testNoOperation() throws Exception {
InterfaceContract source = new MockContract("FooContract");
InterfaceContract target = new MockContract("FooContract");
mapper.checkCompatibility(source, target, false, false);
}
+ @Test
public void testBasic() throws Exception {
InterfaceContract source = new MockContract("FooContract");
Operation opSource1 = newOperation("op1");
@@ -72,6 +76,7 @@ public class ContractCompatibilityTestCase extends TestCase {
mapper.checkCompatibility(source, target, false, false);
}
+ @Test
public void testBasicIncompatibleOperationNames() throws Exception {
InterfaceContract source = new MockContract("FooContract");
Operation opSource1 = newOperation("op1");
@@ -91,6 +96,7 @@ public class ContractCompatibilityTestCase extends TestCase {
}
}
+ @Test
public void testInputTypes() throws Exception {
InterfaceContract source = new MockContract("FooContract");
List<DataType> sourceInputTypes = new ArrayList<DataType>();
@@ -115,6 +121,7 @@ public class ContractCompatibilityTestCase extends TestCase {
mapper.checkCompatibility(source, target, false, false);
}
+ @Test
public void testIncompatibleInputTypes() throws Exception {
InterfaceContract source = new MockContract("FooContract");
List<DataType> sourceInputTypes = new ArrayList<DataType>();
@@ -145,8 +152,9 @@ public class ContractCompatibilityTestCase extends TestCase {
}
/**
- * Verfies source input types can be super types of the target
+ * Verifies source input types can be super types of the target
*/
+ @Test
public void testSourceSuperTypeInputCompatibility() throws Exception {
// InterfaceContract source = new MockContract("FooContract");
// List<DataType> sourceInputTypes = new ArrayList<DataType>();
@@ -177,6 +185,7 @@ public class ContractCompatibilityTestCase extends TestCase {
// wireService.checkCompatibility(source, target, false);
}
+ @Test
public void testOutputTypes() throws Exception {
InterfaceContract source = new MockContract("FooContract");
DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
@@ -199,6 +208,7 @@ public class ContractCompatibilityTestCase extends TestCase {
/**
* Verifies a return type that is a supertype of of the target is compatible
*/
+ @Test
public void testSupertypeOutputTypes() throws Exception {
// InterfaceContract source = new MockContract("FooContract");
// DataType sourceOutputType = new DataTypeImpl<Type>(Object.class,
@@ -222,6 +232,7 @@ public class ContractCompatibilityTestCase extends TestCase {
// wireService.checkCompatibility(source, target, false);
}
+ @Test
public void testIncompatibleOutputTypes() throws Exception {
InterfaceContract source = new MockContract("FooContract");
DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
@@ -246,6 +257,7 @@ public class ContractCompatibilityTestCase extends TestCase {
}
}
+ @Test
public void testFaultTypes() throws Exception {
InterfaceContract source = new MockContract("FooContract");
DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
@@ -270,6 +282,7 @@ public class ContractCompatibilityTestCase extends TestCase {
mapper.checkCompatibility(source, target, false, false);
}
+ @Test
public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
InterfaceContract source = new MockContract("FooContract");
DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
@@ -295,6 +308,7 @@ public class ContractCompatibilityTestCase extends TestCase {
*
* @throws Exception
*/
+ @Test
public void testFaultSuperTypes() throws Exception {
// InterfaceContract source = new MockContract("FooContract");
// DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
@@ -327,6 +341,7 @@ public class ContractCompatibilityTestCase extends TestCase {
* Verifies a source's faults which are supertypes and a superset of the
* target's faults are compatible
*/
+ @Test
public void testFaultSuperTypesAndSuperset() throws Exception {
// InterfaceContract source = new MockContract("FooContract");
// DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,