Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2015-06-02 11:46:49 -0400
committerFlorian Waibel2015-06-02 18:01:36 -0400
commit105e1dd3c482b6caeac8782344858917c9139572 (patch)
tree6a8aefdf326e2db186a79f7f661a471d1e28445b
parent904b717e77eed9c04b60d9812c9a1558bc780cd3 (diff)
downloadorg.eclipse.virgo.medic-105e1dd3c482b6caeac8782344858917c9139572.tar.gz
org.eclipse.virgo.medic-105e1dd3c482b6caeac8782344858917c9139572.tar.xz
org.eclipse.virgo.medic-105e1dd3c482b6caeac8782344858917c9139572.zip
Replaces code using default encoding with code using explicitly UTF-8
-rw-r--r--org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapperTests.java5
-rw-r--r--org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/TeeLoggingPrintStreamWrapperTests.java5
-rw-r--r--org.eclipse.virgo.medic.test/src/test/java/org/eclipse/virgo/medic/test/eventlog/LoggedEventTests.java20
3 files changed, 15 insertions, 15 deletions
diff --git a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapperTests.java b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapperTests.java
index 9e8f0f7..e8be2a9 100644
--- a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapperTests.java
+++ b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/LoggingPrintStreamWrapperTests.java
@@ -11,6 +11,7 @@
package org.eclipse.virgo.medic.log.impl;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -115,7 +116,7 @@ public class LoggingPrintStreamWrapperTests {
public void testByteArrayHandling() {
String string = "Some text to be turned into bytes.";
String stringWithNewLine = string + "\n";
- byte[] stringBytes = stringWithNewLine.getBytes();
+ byte[] stringBytes = stringWithNewLine.getBytes(UTF_8);
wrapper.write(stringBytes, 0, stringBytes.length);
@@ -128,7 +129,7 @@ public class LoggingPrintStreamWrapperTests {
@Test
public void testSingleByteHandling() {
String string = "Some text to be turned into bytes.";
- byte[] stringBytes = string.getBytes();
+ byte[] stringBytes = string.getBytes(UTF_8);
for (byte b: stringBytes) {
wrapper.write(b);
diff --git a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/TeeLoggingPrintStreamWrapperTests.java b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/TeeLoggingPrintStreamWrapperTests.java
index baed712..3f89d9f 100644
--- a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/TeeLoggingPrintStreamWrapperTests.java
+++ b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/impl/TeeLoggingPrintStreamWrapperTests.java
@@ -11,6 +11,7 @@
package org.eclipse.virgo.medic.log.impl;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -127,7 +128,7 @@ public class TeeLoggingPrintStreamWrapperTests {
public void testByteArrayHandling() {
String string = "Some text to be turned into bytes.";
String stringWithNewLine = string + "\n";
- byte[] stringBytes = stringWithNewLine.getBytes();
+ byte[] stringBytes = stringWithNewLine.getBytes(UTF_8);
teeWrapper.write(stringBytes, 0, stringBytes.length);
@@ -140,7 +141,7 @@ public class TeeLoggingPrintStreamWrapperTests {
@Test
public void testSingleByteHandling() {
String string = "Some text to be turned into bytes.";
- byte[] stringBytes = string.getBytes();
+ byte[] stringBytes = string.getBytes(UTF_8);
for (byte b : stringBytes) {
teeWrapper.write(b);
diff --git a/org.eclipse.virgo.medic.test/src/test/java/org/eclipse/virgo/medic/test/eventlog/LoggedEventTests.java b/org.eclipse.virgo.medic.test/src/test/java/org/eclipse/virgo/medic/test/eventlog/LoggedEventTests.java
index 7ad8333..81a76fc 100644
--- a/org.eclipse.virgo.medic.test/src/test/java/org/eclipse/virgo/medic/test/eventlog/LoggedEventTests.java
+++ b/org.eclipse.virgo.medic.test/src/test/java/org/eclipse/virgo/medic/test/eventlog/LoggedEventTests.java
@@ -11,53 +11,51 @@
package org.eclipse.virgo.medic.test.eventlog;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import org.eclipse.virgo.medic.eventlog.Level;
-import org.eclipse.virgo.medic.test.eventlog.LoggedEvent;
import org.junit.Test;
public class LoggedEventTests {
@Test
- public void print() {
+ public void print() throws UnsupportedEncodingException {
StringWriter printedWriter = new StringWriter();
- PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter));
-
+ PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter), true, UTF_8.name());
new LoggedEvent("code", Level.WARNING, "a", 5, true).print(printStream);
-
+
String printed = printedWriter.toString();
assertEquals("Code: 'code' Level: 'WARNING' Inserts: {'a', '5', 'true'}", printed);
}
@Test
- public void printWithOneInsert() {
+ public void printWithOneInsert() throws UnsupportedEncodingException {
StringWriter printedWriter = new StringWriter();
- PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter));
+ PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter), true, UTF_8.name());
new LoggedEvent("code", Level.WARNING, 5).print(printStream);
String printed = printedWriter.toString();
- System.out.println(printed);
assertEquals("Code: 'code' Level: 'WARNING' Inserts: {'5'}", printed);
}
@Test
- public void printWithNoInserts() {
+ public void printWithNoInserts() throws UnsupportedEncodingException {
StringWriter printedWriter = new StringWriter();
- PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter));
+ PrintStream printStream = new PrintStream(new WriterOutputStream(printedWriter), true, UTF_8.name());
new LoggedEvent("code", Level.WARNING).print(printStream);
String printed = printedWriter.toString();
- System.out.println(printed);
assertEquals("Code: 'code' Level: 'WARNING'", printed);
}

Back to the top