Update SentenceTest to match new Sentence prototype.

koppelting
Bertrik Sikken 2017-08-15 08:17:41 +02:00
rodzic b64908e596
commit 6c57c6eb46
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
package nl.sikken.bertrik.hab;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
@ -13,15 +15,15 @@ public final class SentenceTest {
@Test
public void testSentence() throws UnsupportedEncodingException {
final Sentence sentence = new Sentence("CALL", 1, 2, 3.45, 6.78, 9.0);
final Sentence sentence = new Sentence("CALL", 1, new Date(0), 3.45, 6.78, 9.0);
final String s = sentence.format();
Assert.assertEquals("$$CALL,1,00:00:02,3.450000,6.780000,9.0*EFFF\n", s);
Assert.assertEquals("$$CALL,1,00:00:00,3.450000,6.780000,9.0*25E9\n", s);
}
@Test
public void testSentenceExtras() throws UnsupportedEncodingException {
final Sentence sentence = new Sentence("CALL", 1, 2, 3.45, 6.78, 9.0);
final Sentence sentence = new Sentence("CALL", 1, new Date(), 3.45, 6.78, 9.0);
sentence.addField("hello");
final String s = sentence.format();
@ -39,7 +41,7 @@ public final class SentenceTest {
@Test
public void testCrc() throws UnsupportedEncodingException {
final String s = "hadie,181,10:42:10,54.422829,-6.741293,27799.3,1:10";
final byte[] data = s.getBytes("US-ASCII");
final byte[] data = s.getBytes(StandardCharsets.US_ASCII);
final CcittCrc16 crc = new CcittCrc16();
int value = crc.calculate(data, 0xFFFF);