Author: elecharny
Date: Thu Jan 21 12:29:56 2010
New Revision: 901679
URL: http://svn.apache.org/viewvc?rev=901679&view=rev
Log:
Switched the last JUnit 3.7 elements to JUnit 4.7.
Modified:
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetAddressEditorTest.java
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetSocketAddressEditorTest.java
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/VmPipeAddressEditorTest.java
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineFactoryTest.java
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineProxyBuilderTest.java
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineTest.java
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/context/AbstractStateContextLookupTest.java
Modified:
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetAddressEditorTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetAddressEditorTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetAddressEditorTest.java
(original)
+++
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetAddressEditorTest.java
Thu Jan 21 12:29:56 2010
@@ -19,24 +19,28 @@
*/
package org.apache.mina.integration.beans;
+import static org.junit.Assert.assertEquals;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests {...@link InetAddressEditor}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class InetAddressEditorTest extends TestCase {
+public class InetAddressEditorTest {
InetAddressEditor editor;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
editor = new InetAddressEditor();
}
+ @Test
public void testSetAsTextWithHostName() throws Exception {
try {
InetAddress expected = InetAddress.getByName("www.google.com");
@@ -50,6 +54,7 @@
assertEquals(InetAddress.getByName("localhost"), editor.getValue());
}
+ @Test
public void testSetAsTextWithIpAddress() throws Exception {
editor.setAsText("127.0.0.1");
assertEquals(InetAddress.getByName("127.0.0.1"), editor.getValue());
Modified:
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetSocketAddressEditorTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetSocketAddressEditorTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetSocketAddressEditorTest.java
(original)
+++
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/InetSocketAddressEditorTest.java
Thu Jan 21 12:29:56 2010
@@ -19,23 +19,28 @@
*/
package org.apache.mina.integration.beans;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.net.InetSocketAddress;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests {...@link InetSocketAddressEditor}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class InetSocketAddressEditorTest extends TestCase {
+public class InetSocketAddressEditorTest {
InetSocketAddressEditor editor;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
editor = new InetSocketAddressEditor();
}
+ @Test
public void testSetAsTextWithWildcardAddress() throws Exception {
editor.setAsText("1");
assertEquals(new InetSocketAddress(1), editor.getValue());
@@ -43,6 +48,7 @@
assertEquals(new InetSocketAddress(10), editor.getValue());
}
+ @Test
public void testSetAsTextWithHostName() throws Exception {
editor.setAsText("www.google.com:80");
assertEquals(new InetSocketAddress("www.google.com", 80), editor
@@ -55,6 +61,7 @@
.getValue());
}
+ @Test
public void testSetAsTextWithIllegalValues() throws Exception {
try {
editor.setAsText("bar");
@@ -72,5 +79,4 @@
} catch (IllegalArgumentException iae) {
}
}
-
}
Modified:
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/VmPipeAddressEditorTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/VmPipeAddressEditorTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/VmPipeAddressEditorTest.java
(original)
+++
mina/trunk/integration-beans/src/test/java/org/apache/mina/integration/beans/VmPipeAddressEditorTest.java
Thu Jan 21 12:29:56 2010
@@ -19,23 +19,27 @@
*/
package org.apache.mina.integration.beans;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import org.apache.mina.transport.vmpipe.VmPipeAddress;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests {...@link VmPipeAddressEditor}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class VmPipeAddressEditorTest extends TestCase {
+public class VmPipeAddressEditorTest {
VmPipeAddressEditor editor;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
editor = new VmPipeAddressEditor();
}
+ @Test
public void testSetAsTextWithLegalValues() throws Exception {
editor.setAsText("1");
assertEquals(new VmPipeAddress(1), editor.getValue());
@@ -45,6 +49,7 @@
assertEquals(new VmPipeAddress(100), editor.getValue());
}
+ @Test
public void testSetAsTextWithIllegalValues() throws Exception {
try {
editor.setAsText("bar");
@@ -57,5 +62,4 @@
} catch (IllegalArgumentException iae) {
}
}
-
}
Modified:
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineFactoryTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineFactoryTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineFactoryTest.java
(original)
+++
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineFactoryTest.java
Thu Jan 21 12:29:56 2010
@@ -19,25 +19,26 @@
*/
package org.apache.mina.statemachine;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.Method;
import java.util.List;
-import junit.framework.TestCase;
-
-import org.apache.mina.statemachine.State;
-import org.apache.mina.statemachine.StateMachine;
-import org.apache.mina.statemachine.StateMachineCreationException;
-import org.apache.mina.statemachine.StateMachineFactory;
import org.apache.mina.statemachine.annotation.Transition;
import org.apache.mina.statemachine.annotation.Transitions;
import org.apache.mina.statemachine.transition.MethodTransition;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests {...@link StateMachineFactory}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class StateMachineFactoryTest extends TestCase {
+public class StateMachineFactoryTest {
Method barInA;
Method error;
Method fooInA;
@@ -45,7 +46,8 @@
Method barInC;
Method fooOrBarInCOrFooInD;
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
barInA = States.class.getDeclaredMethod("barInA", new Class[0]);
error = States.class.getDeclaredMethod("error", new Class[0]);
fooInA = States.class.getDeclaredMethod("fooInA", new Class[0]);
@@ -54,6 +56,7 @@
fooOrBarInCOrFooInD =
States.class.getDeclaredMethod("fooOrBarInCOrFooInD", new Class[0]);
}
+ @Test
public void testCreate() throws Exception {
States states = new States();
StateMachine sm =
StateMachineFactory.getInstance(Transition.class).create(States.A, states);
@@ -95,6 +98,7 @@
assertEquals(new MethodTransition("foo", fooOrBarInCOrFooInD, states),
trans.get(0));
}
+ @Test
public void testCreateStates() throws Exception {
State[] states =
StateMachineFactory.createStates(StateMachineFactory.getFields(States.class));
assertEquals(States.A, states[0].getId());
@@ -107,6 +111,7 @@
assertEquals(states[0], states[3].getParent());
}
+ @Test
public void testCreateStatesMissingParents() throws Exception {
try {
StateMachineFactory.createStates(StateMachineFactory.getFields(StatesWithMissingParents.class));
Modified:
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineProxyBuilderTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineProxyBuilderTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineProxyBuilderTest.java
(original)
+++
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineProxyBuilderTest.java
Thu Jan 21 12:29:56 2010
@@ -19,22 +19,24 @@
*/
package org.apache.mina.statemachine;
-import java.util.LinkedList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
-import junit.framework.TestCase;
+import java.util.LinkedList;
import org.apache.mina.statemachine.annotation.Transition;
import org.apache.mina.statemachine.annotation.Transitions;
import org.apache.mina.statemachine.event.Event;
import org.apache.mina.statemachine.transition.MethodTransition;
+import org.junit.Test;
/**
* Tests {...@link StateMachineProxyBuilder}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class StateMachineProxyBuilderTest extends TestCase {
-
+public class StateMachineProxyBuilderTest {
+ @Test
public void testReentrantStateMachine() throws Exception {
ReentrantStateMachineHandler handler = new
ReentrantStateMachineHandler();
@@ -52,6 +54,7 @@
assertTrue(handler.finished);
}
+ @Test
public void testTapeDeckStateMachine() throws Exception {
TapeDeckStateMachineHandler handler = new
TapeDeckStateMachineHandler();
@@ -91,6 +94,7 @@
assertTrue(messages.isEmpty());
}
+ @Test
public void testTapeDeckStateMachineAnnotations() throws Exception {
TapeDeckStateMachineHandler handler = new
TapeDeckStateMachineHandler();
Modified:
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineTest.java
(original)
+++
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/StateMachineTest.java
Thu Jan 21 12:29:56 2010
@@ -19,23 +19,23 @@
*/
package org.apache.mina.statemachine;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
-import org.apache.mina.statemachine.State;
-import org.apache.mina.statemachine.StateControl;
-import org.apache.mina.statemachine.StateMachine;
import org.apache.mina.statemachine.context.DefaultStateContext;
import org.apache.mina.statemachine.context.StateContext;
import org.apache.mina.statemachine.event.Event;
import org.apache.mina.statemachine.transition.AbstractTransition;
+import org.junit.Test;
/**
* Tests {...@link StateMachine}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class StateMachineTest extends TestCase {
+public class StateMachineTest {
+ @Test
public void testBreakAndContinue() throws Exception {
State s1 = new State("s1");
s1.addTransition(new BreakAndContinueTransition("foo"));
@@ -47,6 +47,7 @@
assertEquals(true, context.getAttribute("success"));
}
+ @Test
public void testBreakAndGotoNow() throws Exception {
State s1 = new State("s1");
State s2 = new State("s2");
@@ -59,6 +60,7 @@
assertEquals(true, context.getAttribute("success"));
}
+ @Test
public void testBreakAndGotoNext() throws Exception {
State s1 = new State("s1");
State s2 = new State("s2");
Modified:
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/context/AbstractStateContextLookupTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/context/AbstractStateContextLookupTest.java?rev=901679&r1=901678&r2=901679&view=diff
==============================================================================
---
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/context/AbstractStateContextLookupTest.java
(original)
+++
mina/trunk/statemachine/src/test/java/org/apache/mina/statemachine/context/AbstractStateContextLookupTest.java
Thu Jan 21 12:29:56 2010
@@ -19,22 +19,20 @@
*/
package org.apache.mina.statemachine.context;
+import static org.junit.Assert.assertSame;
+
import java.util.HashMap;
import java.util.Map;
-import org.apache.mina.statemachine.context.AbstractStateContextLookup;
-import org.apache.mina.statemachine.context.DefaultStateContextFactory;
-import org.apache.mina.statemachine.context.StateContext;
-
-import junit.framework.TestCase;
+import org.junit.Test;
/**
* Tests {...@link AbstractStateContextLookup}.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
-public class AbstractStateContextLookupTest extends TestCase {
-
+public class AbstractStateContextLookupTest {
+ @Test
public void testLookup() throws Exception {
Map<String, StateContext> map = new HashMap<String, StateContext>();
AbstractStateContextLookup lookup = new AbstractStateContextLookup(