mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-02 19:15:29 -04:00
Major test overhaul part II, now uses JUnit 4 annotation style tests.
This commit is contained in:
parent
9cafe4d9a9
commit
cee29fb6a1
@ -77,7 +77,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.3.1</version>
|
<version>4.7</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package com.twelvemonkeys.servlet;
|
package com.twelvemonkeys.servlet;
|
||||||
|
|
||||||
import com.twelvemonkeys.lang.ObjectAbstractTestCase;
|
import com.twelvemonkeys.lang.ObjectAbstractTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
import java.util.*;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FilterAbstractTestCase
|
* FilterAbstractTestCase
|
||||||
@ -45,6 +47,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
|
|||||||
return new MockFilterChain();
|
return new MockFilterChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInitNull() {
|
public void testInitNull() {
|
||||||
Filter filter = makeFilter();
|
Filter filter = makeFilter();
|
||||||
|
|
||||||
@ -65,6 +68,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInit() {
|
public void testInit() {
|
||||||
Filter filter = makeFilter();
|
Filter filter = makeFilter();
|
||||||
|
|
||||||
@ -79,6 +83,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testLifeCycle() throws ServletException {
|
public void testLifeCycle() throws ServletException {
|
||||||
Filter filter = makeFilter();
|
Filter filter = makeFilter();
|
||||||
|
|
||||||
@ -90,6 +95,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testFilterBasic() throws ServletException, IOException {
|
public void testFilterBasic() throws ServletException, IOException {
|
||||||
Filter filter = makeFilter();
|
Filter filter = makeFilter();
|
||||||
|
|
||||||
@ -103,6 +109,7 @@ public abstract class FilterAbstractTestCase extends ObjectAbstractTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDestroy() {
|
public void testDestroy() {
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.twelvemonkeys.servlet;
|
package com.twelvemonkeys.servlet;
|
||||||
|
|
||||||
import com.twelvemonkeys.io.NullOutputStream;
|
import com.twelvemonkeys.io.NullOutputStream;
|
||||||
|
import org.junit.Test;
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ServletConfigExceptionTestCase
|
* ServletConfigExceptionTestCase
|
||||||
*
|
*
|
||||||
@ -13,7 +14,8 @@ import java.io.PrintWriter;
|
|||||||
* @author last modified by $Author: haku $
|
* @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 $
|
* @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() {
|
public void testThrowCatchPrintStacktrace() {
|
||||||
try {
|
try {
|
||||||
throw new ServletConfigException("FooBar!");
|
throw new ServletConfigException("FooBar!");
|
||||||
@ -23,6 +25,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThrowCatchGetNoCause() {
|
public void testThrowCatchGetNoCause() {
|
||||||
try {
|
try {
|
||||||
throw new ServletConfigException("FooBar!");
|
throw new ServletConfigException("FooBar!");
|
||||||
@ -35,6 +38,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThrowCatchInitCauseNull() {
|
public void testThrowCatchInitCauseNull() {
|
||||||
try {
|
try {
|
||||||
ServletConfigException e = new ServletConfigException("FooBar!");
|
ServletConfigException e = new ServletConfigException("FooBar!");
|
||||||
@ -49,6 +53,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThrowCatchInitCause() {
|
public void testThrowCatchInitCause() {
|
||||||
//noinspection ThrowableInstanceNeverThrown
|
//noinspection ThrowableInstanceNeverThrown
|
||||||
Exception cause = new Exception();
|
Exception cause = new Exception();
|
||||||
@ -66,6 +71,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThrowCatchGetNullCause() {
|
public void testThrowCatchGetNullCause() {
|
||||||
try {
|
try {
|
||||||
throw new ServletConfigException("FooBar!", null);
|
throw new ServletConfigException("FooBar!", null);
|
||||||
@ -78,6 +84,7 @@ public class ServletConfigExceptionTestCase extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThrowCatchGetCause() {
|
public void testThrowCatchGetCause() {
|
||||||
IllegalStateException cause = new IllegalStateException();
|
IllegalStateException cause = new IllegalStateException();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user