Major test overhaul part II, now uses JUnit 4 annotation style tests.

This commit is contained in:
Harald Kuhr 2011-10-18 20:28:06 +02:00
parent 9cafe4d9a9
commit cee29fb6a1
3 changed files with 23 additions and 9 deletions

View File

@ -77,7 +77,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.3.1</version>
<version>4.7</version>
<scope>test</scope>
</dependency>

View File

@ -1,13 +1,15 @@
package com.twelvemonkeys.servlet;
import com.twelvemonkeys.lang.ObjectAbstractTestCase;
import java.util.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.*;
import org.junit.Test;
import javax.servlet.*;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import static org.junit.Assert.*;
/**
* FilterAbstractTestCase
@ -45,6 +47,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
return new MockFilterChain();
}
@Test
public void testInitNull() {
Filter filter = makeFilter();
@ -65,6 +68,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
}
}
@Test
public void testInit() {
Filter filter = makeFilter();
@ -79,6 +83,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
}
}
@Test
public void testLifeCycle() throws ServletException {
Filter filter = makeFilter();
@ -90,6 +95,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
}
}
@Test
public void testFilterBasic() throws ServletException, IOException {
Filter filter = makeFilter();
@ -103,6 +109,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
}
}
@Test
public void testDestroy() {
// TODO: Implement
}

View File

@ -1,11 +1,12 @@
package com.twelvemonkeys.servlet;
import com.twelvemonkeys.io.NullOutputStream;
import junit.framework.TestCase;
import org.junit.Test;
import java.io.PrintWriter;
import static org.junit.Assert.*;
/**
* ServletConfigExceptionTestCase
*
@ -13,7 +14,8 @@ import java.io.PrintWriter;
* @author last modified by $Author: haku $
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-servlet/src/test/java/com/twelvemonkeys/servlet/ServletConfigExceptionTestCase.java#2 $
*/
public class ServletConfigExceptionTestCase extends TestCase {
public class ServletConfigExceptionTestCase {
@Test
public void testThrowCatchPrintStacktrace() {
try {
throw new ServletConfigException("FooBar!");
@ -23,6 +25,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
}
}
@Test
public void testThrowCatchGetNoCause() {
try {
throw new ServletConfigException("FooBar!");
@ -35,6 +38,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
}
}
@Test
public void testThrowCatchInitCauseNull() {
try {
ServletConfigException e = new ServletConfigException("FooBar!");
@ -49,6 +53,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
}
}
@Test
public void testThrowCatchInitCause() {
//noinspection ThrowableInstanceNeverThrown
Exception cause = new Exception();
@ -66,6 +71,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
}
}
@Test
public void testThrowCatchGetNullCause() {
try {
throw new ServletConfigException("FooBar!", null);
@ -78,6 +84,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
}
}
@Test
public void testThrowCatchGetCause() {
IllegalStateException cause = new IllegalStateException();
try {