aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 13:26:16 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-04 13:26:16 +1200
commit4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b (patch)
tree2b6d67fa7164d6b0cb41d3c5162556818b53cd1c /test
parent2d920ecec746615281802e068044a3122a0ae90b (diff)
downloadtraccar-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.tar.gz
traccar-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.tar.bz2
traccar-server-4b4d68a4e6ee3bad66e00bd9905c572ad9c7b91b.zip
Explicitly use ASCII charset
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/ProtocolTest.java3
-rw-r--r--test/org/traccar/helper/ChecksumTest.java3
-rw-r--r--test/org/traccar/helper/StringFinderTest.java3
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java4
4 files changed, 8 insertions, 5 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index 2f5f3962f..a8f3d13cf 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -15,6 +15,7 @@ import org.traccar.model.Position;
import javax.xml.bind.DatatypeConverter;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -87,7 +88,7 @@ public class ProtocolTest {
}
protected ChannelBuffer buffer(String... data) {
- return ChannelBuffers.copiedBuffer(concatenateStrings(data), Charset.defaultCharset());
+ return ChannelBuffers.copiedBuffer(concatenateStrings(data), StandardCharsets.US_ASCII);
}
protected DefaultHttpRequest request(String url) {
diff --git a/test/org/traccar/helper/ChecksumTest.java b/test/org/traccar/helper/ChecksumTest.java
index a2e69eb5a..82bae7346 100644
--- a/test/org/traccar/helper/ChecksumTest.java
+++ b/test/org/traccar/helper/ChecksumTest.java
@@ -6,12 +6,13 @@ import org.junit.Assert;
import org.junit.Test;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
public class ChecksumTest {
@Test
public void testCrc16() {
- ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", Charset.defaultCharset());
+ ChannelBuffer buf = ChannelBuffers.copiedBuffer("123456789", StandardCharsets.US_ASCII);
Assert.assertEquals(0x906e, Checksum.crc16(Checksum.CRC16_X25, buf.toByteBuffer()));
Assert.assertEquals(0x29b1, Checksum.crc16(Checksum.CRC16_CCITT_FALSE, buf.toByteBuffer()));
diff --git a/test/org/traccar/helper/StringFinderTest.java b/test/org/traccar/helper/StringFinderTest.java
index 71f9215db..1c8234db1 100644
--- a/test/org/traccar/helper/StringFinderTest.java
+++ b/test/org/traccar/helper/StringFinderTest.java
@@ -8,6 +8,7 @@ import org.junit.Assert;
import org.junit.Test;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@@ -17,7 +18,7 @@ public class StringFinderTest {
@Test
public void testFind() {
- ChannelBuffer buf = ChannelBuffers.copiedBuffer("hello world", Charset.defaultCharset());
+ ChannelBuffer buf = ChannelBuffers.copiedBuffer("hello world", StandardCharsets.US_ASCII);
Assert.assertEquals(-1, buf.indexOf(0, buf.writerIndex(), new StringFinder("bar")));
Assert.assertEquals(6, buf.indexOf(0, buf.writerIndex(), new StringFinder("world")));
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index 3969e8b2c..b95d8ddce 100644
--- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -32,10 +32,10 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
"(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)"));
/*verifyPosition(decoder, text( ChannelBuffers.copiedBuffer(
- "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", Charset.defaultCharset())));
+ "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", StandardCharsets.US_ASCII)));
verifyPosition(decoder, text( ChannelBuffers.copiedBuffer(
- "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)", Charset.defaultCharset())));*/
+ "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)",StandardCharsets.US_ASCII))));*/
}