Skip to content

Commit

Permalink
Get rid of the deprecated junit.framework.Assert API.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1437158 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bvahdat committed Jan 22, 2013
1 parent 7d6d561 commit 04f15e9
Show file tree
Hide file tree
Showing 42 changed files with 106 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.camel.builder.xml;

import junit.framework.Assert;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
Expand Down Expand Up @@ -54,7 +52,7 @@ public void testXPathWithNamespaceDifferentNamespace() throws Exception {
template.sendBody("direct:in", "<number xmlns=\"http://acme.com/cake\">55</number>");

mock.assertIsSatisfied();
Assert.assertNull(mock.getExchanges().get(0).getIn().getHeader("foo"));
assertNull(mock.getExchanges().get(0).getIn().getHeader("foo"));
}

protected RouteBuilder createRouteBuilder() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import javax.naming.Context;

import junit.framework.Assert;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.util.jndi.JndiContext;
Expand All @@ -29,11 +28,11 @@ public void testRoute() throws Exception {

String stringBody = "stringBody";
String stringResponse = (String)template.requestBody("direct:in", stringBody);
Assert.assertEquals(stringBody, stringResponse);
assertEquals(stringBody, stringResponse);

Integer intBody = 1;
Integer intResponse = (Integer)template.requestBody("direct:in", intBody);
Assert.assertEquals(1, intResponse.intValue());
assertEquals(1, intResponse.intValue());
}

protected RouteBuilder createRouteBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.camel.component.bean;

import junit.framework.Assert;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.impl.DefaultExchange;

Expand All @@ -38,7 +36,7 @@ public void testInheritance() throws Exception {
assertEquals("process", mi.getMethod().getName());
assertEquals("Y", mi.getMethod().getDeclaringClass().getSimpleName());
} catch (AmbiguousMethodCallException e) {
Assert.fail("This should not be ambiguous!");
fail("This should not be ambiguous!");
}
}

Expand All @@ -54,7 +52,7 @@ public void testNoInheritance() throws Exception {
assertEquals("process", mi.getMethod().getName());
assertEquals("A", mi.getMethod().getDeclaringClass().getSimpleName());
} catch (AmbiguousMethodCallException e) {
Assert.fail("This should not be ambiguous!");
fail("This should not be ambiguous!");
}
}

Expand All @@ -66,7 +64,7 @@ public void testInheritanceAndOverload() throws Exception {

try {
beanInfo.createInvocation(null, exchange);
Assert.fail("This should be ambiguous!");
fail("This should be ambiguous!");
} catch (AmbiguousMethodCallException e) {
// expected (currently not supported in camel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

import org.w3c.dom.Element;

import junit.framework.Assert;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
Expand Down Expand Up @@ -96,7 +94,7 @@ public void process(Exchange exchange) throws Exception {
CxfPayload<SoapHeader> in = exchange.getIn().getBody(CxfPayload.class);

// verify request
Assert.assertEquals(1, in.getBody().size());
assertEquals(1, in.getBody().size());

Map<String, String> ns = new HashMap<String, String>();
ns.put("ns", MtomTestHelper.SERVICE_TYPES_NS);
Expand All @@ -107,19 +105,19 @@ public void process(Exchange exchange) throws Exception {
Element ele = (Element)xu.getValue("//ns:Detail/ns:photo/xop:Include", body,
XPathConstants.NODE);
String photoId = ele.getAttribute("href").substring(4); // skip "cid:"
Assert.assertEquals(MtomTestHelper.REQ_PHOTO_CID, photoId);
assertEquals(MtomTestHelper.REQ_PHOTO_CID, photoId);

ele = (Element)xu.getValue("//ns:Detail/ns:image/xop:Include", body,
XPathConstants.NODE);
String imageId = ele.getAttribute("href").substring(4); // skip "cid:"
Assert.assertEquals(MtomTestHelper.REQ_IMAGE_CID, imageId);
assertEquals(MtomTestHelper.REQ_IMAGE_CID, imageId);

DataHandler dr = exchange.getIn().getAttachment(photoId);
Assert.assertEquals("application/octet-stream", dr.getContentType());
assertEquals("application/octet-stream", dr.getContentType());
MtomTestHelper.assertEquals(MtomTestHelper.REQ_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream()));

dr = exchange.getIn().getAttachment(imageId);
Assert.assertEquals("image/jpeg", dr.getContentType());
assertEquals("image/jpeg", dr.getContentType());
MtomTestHelper.assertEquals(MtomTestHelper.requestJpeg, IOUtils.readBytesFromStream(dr.getInputStream()));

// create response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;

import junit.framework.Assert;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.cxf.CXFTestSupport;
import org.apache.camel.component.cxf.CxfPayload;
import org.apache.cxf.binding.soap.SoapHeader;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.IOUtils;
import org.springframework.test.context.ContextConfiguration;

import org.junit.Assert;

import org.springframework.test.context.ContextConfiguration;

/**
* Unit test for exercising SOAP with Attachment (SwA) feature of a CxfConsumer in PAYLOAD mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPBinding;

import junit.framework.Assert;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.cxf.CXFTestSupport;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
import javax.xml.ws.Holder;
import javax.xml.ws.soap.SOAPBinding;

import junit.framework.Assert;

import org.apache.camel.CamelContext;
import org.apache.camel.component.cxf.CXFTestSupport;
import org.apache.camel.cxf.mtom_feature.Hello;
import org.apache.camel.cxf.mtom_feature.HelloService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import javax.imageio.ImageIO;
import javax.xml.ws.Holder;

import junit.framework.Assert;

import org.apache.camel.cxf.mtom_feature.Hello;

import org.junit.Assert;

/**
* Hello Test Impl class
* @version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

import java.io.IOException;

import junit.framework.Assert;

import org.apache.cxf.helpers.IOUtils;

import org.junit.Assert;

/**
* Package local test helper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.File;
import java.util.List;

import junit.framework.Assert;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.net.URL;
import java.nio.ByteBuffer;

import junit.framework.Assert;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.InputStream;
import java.net.URL;

import junit.framework.Assert;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -75,7 +74,7 @@ public void testSimpleWriteFileWithIdleSplit() throws Exception {
in = new URL("file:///" + BASE_FILE.toUri() + "3/" + HdfsConstants.DEFAULT_SEGMENT_PREFIX + i).openStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copyBytes(in, bos, 4096, false);
Assert.assertEquals("CIAO" + i, new String(bos.toByteArray()));
assertEquals("CIAO" + i, new String(bos.toByteArray()));
} finally {
IOUtils.closeStream(in);
}
Expand Down Expand Up @@ -108,7 +107,7 @@ private void doTest(int routeNr) throws Exception {
in = new URL("file:///" + BASE_FILE.toUri() + routeNr + '/' + HdfsConstants.DEFAULT_SEGMENT_PREFIX + i).openStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copyBytes(in, bos, 4096, false);
Assert.assertEquals("CIAO" + i, new String(bos.toByteArray()));
assertEquals("CIAO" + i, new String(bos.toByteArray()));
} finally {
IOUtils.closeStream(in);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.File;

import junit.framework.Assert;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -72,7 +71,7 @@ public void testProducer() throws Exception {
int i = 0;
while (reader.next(key, value)) {
Text txt = (Text) value;
Assert.assertTrue(("PAPPO" + i).equals(txt.toString()));
assertTrue(("PAPPO" + i).equals(txt.toString()));
++i;
}
}
Expand All @@ -93,7 +92,7 @@ public void testWriteBoolean() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
Boolean rBoolean = ((BooleanWritable) value).get();
Assert.assertEquals(rBoolean, aBoolean);
assertEquals(rBoolean, aBoolean);
}

@Test
Expand All @@ -112,7 +111,7 @@ public void testWriteByte() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
byte rByte = ((ByteWritable) value).get();
Assert.assertEquals(rByte, aByte);
assertEquals(rByte, aByte);
}

@Test
Expand All @@ -131,7 +130,7 @@ public void testWriteInt() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
int rInt = ((IntWritable) value).get();
Assert.assertEquals(rInt, anInt);
assertEquals(rInt, anInt);
}

@Test
Expand All @@ -150,15 +149,15 @@ public void testWriteFloat() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
float rFloat = ((FloatWritable) value).get();
Assert.assertEquals(rFloat, aFloat);
assertEquals(rFloat, aFloat, 0.0F);
}

@Test
public void testWriteDouble() throws Exception {
if (SKIP) {
return;
}
double aDouble = 12.34d;
Double aDouble = 12.34D;
template.sendBody("direct:write_double", aDouble);
stopCamelContext();
Configuration conf = new Configuration();
Expand All @@ -169,7 +168,7 @@ public void testWriteDouble() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
Double rDouble = ((DoubleWritable) value).get();
Assert.assertEquals(rDouble, aDouble);
assertEquals(rDouble, aDouble);
}

@Test
Expand All @@ -188,7 +187,7 @@ public void testWriteLong() throws Exception {
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
long rLong = ((LongWritable) value).get();
Assert.assertEquals(rLong, aLong);
assertEquals(rLong, aLong);
}

@Test
Expand All @@ -207,7 +206,7 @@ public void testWriteText() throws Exception {
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
String rTxt = value.toString();
Assert.assertEquals(rTxt, txt);
assertEquals(rTxt, txt);
}

@Test
Expand All @@ -226,8 +225,8 @@ public void testWriteTextWithKey() throws Exception {
Text key = (Text) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
Assert.assertEquals(key.toString(), txtKey);
Assert.assertEquals(value.toString(), txtValue);
assertEquals(key.toString(), txtKey);
assertEquals(value.toString(), txtValue);
}

@Test
Expand All @@ -246,8 +245,8 @@ public void testMapWriteTextWithKey() throws Exception {
Text key = (Text) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
Assert.assertEquals(key.toString(), txtKey);
Assert.assertEquals(value.toString(), txtValue);
assertEquals(key.toString(), txtKey);
assertEquals(value.toString(), txtValue);
}

@Test
Expand All @@ -264,7 +263,7 @@ public void testArrayWriteText() throws Exception {
ArrayFile.Reader reader = new ArrayFile.Reader(fs1, "file:///" + TEMP_DIR.toUri() + "test-camel-text4", conf);
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(value);
Assert.assertEquals(value.toString(), txtValue);
assertEquals(value.toString(), txtValue);
}

@Test
Expand All @@ -283,8 +282,8 @@ public void testBloomMapWriteText() throws Exception {
Text key = (Text) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
Assert.assertEquals(key.toString(), txtKey);
Assert.assertEquals(value.toString(), txtValue);
assertEquals(key.toString(), txtKey);
assertEquals(value.toString(), txtValue);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/
package org.apache.camel.component.hdfs.integration;

import junit.framework.Assert;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

Expand Down
Loading

0 comments on commit 04f15e9

Please sign in to comment.