package seng302.Networking.MessageDecoders;

import org.junit.Assert;
import org.junit.Test;
import seng302.Networking.MessageEncoders.RaceVisionByteEncoder;

/**
 * Created by hba56 on 23/04/17.
 */
public class RaceStartStatusDecoderTest {
    @Test
    public void getByteArrayTest(){
        long time = System.currentTimeMillis();

        RaceVisionByteEncoder raceVisionByteEncoder = new RaceVisionByteEncoder();
        long time2 = System.currentTimeMillis();
        byte[] encodedRaceStartStatus = raceVisionByteEncoder.raceStartStatus(time, (short)1,
                time2, 2, (char)3);

        RaceStartStatusDecoder testDecoder = new RaceStartStatusDecoder(encodedRaceStartStatus);

        Assert.assertEquals(0b1, testDecoder.getMessageVersion());
        Assert.assertEquals(time, testDecoder.getTime());
        Assert.assertEquals(1, testDecoder.getAck());
        Assert.assertEquals(time2, testDecoder.getStartTime());
        Assert.assertEquals(2, testDecoder.getRaceID());
        Assert.assertEquals((char)3, testDecoder.getNotification());

    }
}
