Skip to content

Commit

Permalink
fix CP56Time2a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gythialy committed Nov 22, 2016
1 parent b5e7ddb commit a2a8fe1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/test/java/org/openmuc/j60870/CP56Time2aTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@
import org.junit.Assert;
import org.junit.Test;

import java.util.TimeZone;

public class CP56Time2aTest {

@Test
public void testTimestampToCalendar() {
long timestamp = 1383060654596l;
TimeZone timeZone = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
IeTime56 time = new IeTime56(timestamp);
byte[] buffer = new byte[7];
time.encode(buffer, 0);
Assert.assertArrayEquals(new byte[] { 0x44, (byte) 0xd5, 0x1e, 0x17, 0x5d, 0x0a, 0x0d }, buffer);
Assert.assertArrayEquals(new byte[]{0x44, (byte) 0xd5, 0x1e, 0x17, 0x5d, 0x0a, 0x0d}, buffer);

Assert.assertEquals(timestamp, time.getTimestamp());

TimeZone.setDefault(timeZone);
}
}

0 comments on commit a2a8fe1

Please sign in to comment.