Search in sources :

Example 1 with PacketCastingPercent

use of com.solinia.solinia.Models.PacketCastingPercent in project solinia3-core by mixxit.

the class PacketCastingPercentTest method IfMissingSeperatorsThrowInvalidPacket.

@Test
public void IfMissingSeperatorsThrowInvalidPacket() {
    String expectedException = "Packet data is wrong format";
    String actualException = "";
    try {
        new PacketCastingPercent().fromPacketData("moo");
    } catch (InvalidPacketException e) {
        actualException = e.getMessage();
    }
    assertEquals(expectedException, actualException);
}
Also used : PacketCastingPercent(com.solinia.solinia.Models.PacketCastingPercent) InvalidPacketException(com.solinia.solinia.Exceptions.InvalidPacketException) Test(org.junit.Test)

Example 2 with PacketCastingPercent

use of com.solinia.solinia.Models.PacketCastingPercent in project solinia3-core by mixxit.

the class PacketCastingPercentTest method IfMissingNullThrowInvalidPacket.

@Test
public void IfMissingNullThrowInvalidPacket() {
    String expectedException = "Packet data is empty";
    String actualException = "";
    try {
        new PacketCastingPercent().fromPacketData(null);
    } catch (InvalidPacketException e) {
        actualException = e.getMessage();
    }
    assertEquals(expectedException, actualException);
}
Also used : PacketCastingPercent(com.solinia.solinia.Models.PacketCastingPercent) InvalidPacketException(com.solinia.solinia.Exceptions.InvalidPacketException) Test(org.junit.Test)

Example 3 with PacketCastingPercent

use of com.solinia.solinia.Models.PacketCastingPercent in project solinia3-core by mixxit.

the class PacketCastingPercentTest method WhenGivenPacketDataReturnExpectedFormat.

@Test
public void WhenGivenPacketDataReturnExpectedFormat() {
    String testForPacketData = "1.0^";
    String foundPacketData = "";
    try {
        PacketCastingPercent vitals = new PacketCastingPercent();
        vitals.fromPacketData(testForPacketData);
        foundPacketData = vitals.toPacketData();
    } catch (InvalidPacketException e) {
        e.printStackTrace();
    }
    assertEquals(testForPacketData, foundPacketData);
}
Also used : PacketCastingPercent(com.solinia.solinia.Models.PacketCastingPercent) InvalidPacketException(com.solinia.solinia.Exceptions.InvalidPacketException) Test(org.junit.Test)

Aggregations

InvalidPacketException (com.solinia.solinia.Exceptions.InvalidPacketException)3 PacketCastingPercent (com.solinia.solinia.Models.PacketCastingPercent)3 Test (org.junit.Test)3