Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
grobmeier committed Oct 24, 2023
1 parent 5082459 commit b089f95
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/test/java/org/apache/log4j/xml/XMLDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
import java.nio.CharBuffer;
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 {

public String getStringFromResource(final String resourceName,
final int maxSize) throws Exception {
InputStream is = XMLDecoderTest.class.getResourceAsStream(resourceName);
if (is == null) {
throw new FileNotFoundException(resourceName);
}
InputStreamReader reader = new InputStreamReader(is, "UTF-8");
CharBuffer cb = CharBuffer.allocate(maxSize);
public String getStringFromResource(final String resourceName,
final int maxSize) throws Exception {
InputStream is = XMLDecoderTest.class.getResourceAsStream(resourceName);
if (is == null) {
throw new FileNotFoundException(resourceName);
}
InputStreamReader reader = new InputStreamReader(is, "UTF-8");
CharBuffer cb = CharBuffer.allocate(maxSize);

while (reader.read(cb) != -1);
while (reader.read(cb) != -1) ;

cb.flip();
return cb.toString();
}
cb.flip();
return cb.toString();
}

@Test
public void testDecodeEventsString1() throws Exception {
Expand All @@ -59,12 +59,12 @@ public void testDecodeEventsString1() throws Exception {
}

@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());
}
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 {
Expand Down

0 comments on commit b089f95

Please sign in to comment.