@Test public void canBeCompressed_bothCommandAreParameterizedCommandButWithDifferentGroups() { PclCommandBuilder builder = new PclCommandBuilder().p(LOWEST_PARAMETERIZED_BYTE).v("1").t(LOWEST_TERMINATION_BYTE); PclCommand command = builder.copy().g(LOWEST_GROUP_BYTE).toCommand(); PclCommand otherCommand = builder.copy().g(HIGHEST_GROUP_BYTE).toCommand(); assertFalse(compressor.canBeCompressed(command, otherCommand)); }
@Test public void canBeCompressed_bothCommandAreParameterizedCommandWithMatchingParameterizedAndGroupBytes() { PclCommand command = new PclCommandBuilder() .p(LOWEST_PARAMETERIZED_BYTE) .g(LOWEST_GROUP_BYTE) .v("1") .t(LOWEST_TERMINATION_BYTE) .toCommand(); assertTrue(compressor.canBeCompressed(command, command)); }
@Test public void canBeCompressed_bothCommandAreParameterizedButFirstCommandHasBinaryData() { PclCommandBuilder builder = new PclCommandBuilder() .p(LOWEST_PARAMETERIZED_BYTE) .g(LOWEST_GROUP_BYTE) .v("1") .t(LOWEST_TERMINATION_BYTE); PclCommand command = builder.copy().d("12").toCommand(); PclCommand otherCommand = builder.toCommand(); assertFalse(compressor.canBeCompressed(command, otherCommand)); }
@Test public void canBeCompressed_secondCommandIsATextCommand() { assertFalse( compressor.canBeCompressed( new ParameterizedCommand(new byte[3]), new TextCommand("X".getBytes()))); }
@Test public void canBeCompressed_firstCommandIsATwoByteCommandAndCanNotBeCompressed() { assertFalse( compressor.canBeCompressed( new TwoByteCommand(new byte[2]), new ParameterizedCommand(new byte[3]))); }
@Test public void canBeCompressed_firstCommandIsNullAndCanNotBeCompressed() { assertFalse(compressor.canBeCompressed(null, new ParameterizedCommand(new byte[3]))); }