summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-02 16:00:01 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-02 16:00:01 +0000
commit3fe3ee5d0474fef1e0fd3364a576c237d472da60 (patch)
tree289fa879f85439aa420b94119845aa465949230b /java/sca
parente401b8734ddffc65b0319e7727f0bf7334dbb6d4 (diff)
Converted unit tests from JUnit 3 to JUnit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@722505 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java22
-rw-r--r--java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java5
-rw-r--r--java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java17
-rw-r--r--java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java21
-rw-r--r--java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java17
5 files changed, 46 insertions, 36 deletions
diff --git a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java
index 3744ff8adb..97038734f5 100644
--- a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java
+++ b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java
@@ -19,16 +19,18 @@
package org.apache.tuscany.sca.databinding.jaxb;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
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.util.XMLType;
+import org.junit.Before;
+import org.junit.Test;
import com.example.ipo.jaxb.ObjectFactory;
import com.example.ipo.jaxb.PurchaseOrderType;
@@ -39,15 +41,11 @@ import com.example.ipo.jaxb.USState;
*
* @version $Rev$ $Date$
*/
-public class JAXBDataBindingTestCase extends TestCase {
+public class JAXBDataBindingTestCase {
private JAXBDataBinding binding;
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
binding = new JAXBDataBinding();
}
@@ -55,6 +53,7 @@ public class JAXBDataBindingTestCase extends TestCase {
* Test method for
* {@link org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Operation)}.
*/
+ @Test
public final void testIntrospect() {
DataType dataType = new DataTypeImpl<Class>(JAXBElement.class, null);
Operation op = null;
@@ -99,6 +98,7 @@ public class JAXBDataBindingTestCase extends TestCase {
}
@SuppressWarnings("unchecked")
+ @Test
public void testCopy() {
ObjectFactory factory = new ObjectFactory();
PurchaseOrderType poType = factory.createPurchaseOrderType();
@@ -107,6 +107,7 @@ public class JAXBDataBindingTestCase extends TestCase {
assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getName());
}
+ @Test
public void testCopyNonElement() {
ObjectFactory factory = new ObjectFactory();
PurchaseOrderType poType = factory.createPurchaseOrderType();
@@ -116,6 +117,7 @@ public class JAXBDataBindingTestCase extends TestCase {
assertEquals("Comment", (copy).getComment());
}
+ @Test
public void testCopyNonRoot() {
ObjectFactory factory = new ObjectFactory();
USAddress address = factory.createUSAddress();
diff --git a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java
index 9d85c32e63..f5cff68969 100644
--- a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java
+++ b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java
@@ -23,13 +23,14 @@ import java.util.Map;
import javax.xml.bind.JAXBContext;
-import junit.framework.TestCase;
+import org.junit.Test;
/**
* @version $Rev$ $Date$
*/
-public class JAXBReflectionTestCase extends TestCase {
+public class JAXBReflectionTestCase {
+ @Test
public void testGenerateSchema() throws Exception {
JAXBContext context = JAXBContext.newInstance("com.example.ipo.jaxb");
Map<String, String> schemas = JAXBTypeHelper.generateSchema(context);
diff --git a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java
index 8780b788af..932b4e9f93 100644
--- a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java
+++ b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java
@@ -30,6 +30,7 @@ import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.junit.Test;
import org.w3c.dom.Node;
import com.example.ipo.jaxb.ObjectFactory;
@@ -39,7 +40,7 @@ import com.example.ipo.jaxb.PurchaseOrderType;
*
* @version $Rev$ $Date$
*/
-public class JAXBTestCase extends TestCase {
+public class JAXBTestCase {
private static final String IPO_XML =
"<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
@@ -70,11 +71,7 @@ public class JAXBTestCase extends TestCase {
+ " </items>"
+ "</ipo:purchaseOrder>";
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
+ @Test
public void testTransform() throws Exception {
Reader2JAXB t0 = new Reader2JAXB();
@@ -101,6 +98,7 @@ public class JAXBTestCase extends TestCase {
}
+ @Test
public void testTransform2() throws Exception {
Reader2JAXB t0 = new Reader2JAXB();
@@ -129,6 +127,7 @@ public class JAXBTestCase extends TestCase {
}
+ @Test
public void testTransform3() throws Exception {
DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
@@ -144,10 +143,4 @@ public class JAXBTestCase extends TestCase {
Assert.assertNotNull(node);
}
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
}
diff --git a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java
index c10a5227ce..7a7bfd0606 100644
--- a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java
+++ b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java
@@ -19,22 +19,24 @@
package org.apache.tuscany.sca.databinding.jaxb;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHandler;
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.apache.tuscany.sca.interfacedef.util.ElementInfo;
import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.junit.Before;
+import org.junit.Test;
import com.example.stock.StockQuoteOffer;
@@ -43,20 +45,17 @@ import com.example.stock.StockQuoteOffer;
*
* @version $Rev$ $Date$
*/
-public class JAXBWrapperHandlerTestCase extends TestCase {
+public class JAXBWrapperHandlerTestCase {
private static final QName ELEMENT = new QName("http://www.example.com/stock", "stockQuoteOffer");
private static final QName INPUT = new QName("", "input");
private JAXBWrapperHandler handler;
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
this.handler = new JAXBWrapperHandler();
}
+ @Test
public void testCreate() {
ElementInfo element = new ElementInfo(ELEMENT, null);
Operation op = new OperationImpl();
@@ -68,12 +67,14 @@ public class JAXBWrapperHandlerTestCase extends TestCase {
Assert.assertTrue(offer instanceof StockQuoteOffer);
}
+ @Test
public void testSetChild() {
StockQuoteOffer wrapper = new StockQuoteOffer();
handler.setChild(wrapper, 0, new ElementInfo(INPUT, null), "IBM");
Assert.assertEquals("IBM", wrapper.getInput());
}
+ @Test
public void testGetChildren() {
StockQuoteOffer wrapper = new StockQuoteOffer();
wrapper.setInput("IBM");
diff --git a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java
index e70987de51..b9370c9387 100644
--- a/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java
+++ b/java/sca/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.tuscany.sca.databinding.jaxb;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Map;
@@ -27,14 +31,16 @@ import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import junit.framework.TestCase;
+import org.junit.Test;
/**
*
* @version $Rev$ $Date$
*/
-public class POJOTestCase extends TestCase {
+public class POJOTestCase {
+
+ @Test
public void testAdapter() throws Exception {
JAXBContext context = JAXBContext.newInstance(MyJaxbBean.class, MyInterfaceImpl.class);
StringWriter writer = new StringWriter();
@@ -53,6 +59,7 @@ public class POJOTestCase extends TestCase {
System.out.println(schemas);
}
+ @Test
public void testPOJO() throws Exception {
JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
StringWriter writer = new StringWriter();
@@ -78,6 +85,7 @@ public class POJOTestCase extends TestCase {
assertEquals(bean, newBean);
}
+ @Test
public void testPOJOArray() throws Exception {
JAXBContext context = JAXBContext.newInstance(MyBean[].class, MySubBean.class);
StringWriter writer = new StringWriter();
@@ -136,6 +144,7 @@ public class POJOTestCase extends TestCase {
}
*/
+ @Test
public void testString() throws Exception {
JAXBContext context = JAXBContext.newInstance(String.class);
StringWriter writer = new StringWriter();
@@ -149,6 +158,7 @@ public class POJOTestCase extends TestCase {
assertEquals("ABC", e2.getValue());
}
+ @Test
public void testNull() throws Exception {
JAXBContext context = JAXBContext.newInstance(String.class);
StringWriter writer = new StringWriter();
@@ -163,6 +173,7 @@ public class POJOTestCase extends TestCase {
assertNull(e2.getValue());
}
+ @Test
public void testArray() throws Exception {
JAXBContext context = JAXBContext.newInstance(String[].class);
StringWriter writer = new StringWriter();
@@ -177,6 +188,7 @@ public class POJOTestCase extends TestCase {
assertTrue(e2.getValue() instanceof String[]);
}
+ @Test
public void testByteArray() throws Exception {
JAXBContext context = JAXBContext.newInstance(byte[].class);
StringWriter writer = new StringWriter();
@@ -193,6 +205,7 @@ public class POJOTestCase extends TestCase {
assertTrue(e2.getValue() instanceof byte[]);
}
+ @Test
public void testPrimitive() throws Exception {
JAXBContext context = JAXBContext.newInstance(int.class);
StringWriter writer = new StringWriter();