Skip to content

Commit

Permalink
upgraded to Junit 4 standards
Browse files Browse the repository at this point in the history
  • Loading branch information
grobmeier committed Oct 24, 2023
1 parent 4da29a5 commit 5082459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
19 changes: 8 additions & 11 deletions src/test/java/org/apache/log4j/xml/XMLDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,15 @@
import java.util.Vector;
import java.net.URL;
import org.apache.log4j.chainsaw.logevents.ChainsawLoggingEvent;
import org.junit.Test;

import static junit.framework.TestCase.assertEquals;

/**
* Tests for XMLDecoder.
*
*/
public class XMLDecoderTest extends TestCase {


/**
* Constructor for XMLDecoderTest.
* @param arg0 test name.
*/
public XMLDecoderTest(String arg0) {
super(arg0);
}
public class XMLDecoderTest {

public String getStringFromResource(final String resourceName,
final int maxSize) throws Exception {
Expand All @@ -56,32 +50,35 @@ public String getStringFromResource(final String resourceName,
return cb.toString();
}

@Test
public void testDecodeEventsString1() throws Exception {
String xmlStr = getStringFromResource("xmlLayout.1.xml", 10000);
XMLDecoder decoder = new XMLDecoder();
Vector<ChainsawLoggingEvent> events = decoder.decodeEvents(xmlStr);
assertEquals(17, events.size());
}

@Test
public void testDecodeEventsString2() throws Exception {
String xmlStr = getStringFromResource("xsltLayout.1.xml", 10000);
XMLDecoder decoder = new XMLDecoder();
Vector<ChainsawLoggingEvent> events = decoder.decodeEvents(xmlStr);
assertEquals(15, events.size());
}

@Test
public void testDecodeEventsURL1() throws Exception {
URL resource = XMLDecoderTest.class.getResource("xmlLayout.1.xml");
XMLDecoder decoder = new XMLDecoder();
Vector<ChainsawLoggingEvent> events = decoder.decode(resource);
assertEquals(17, events.size());
}

@Test
public void testDecodeEventsURL2() throws Exception {
URL resource = XMLDecoderTest.class.getResource("xsltLayout.1.xml");
XMLDecoder decoder = new XMLDecoder();
Vector<ChainsawLoggingEvent> events = decoder.decode(resource);
assertEquals(15, events.size());
}

}

0 comments on commit 5082459

Please sign in to comment.