Exemplo n.º 1
0
  @Test
  public void compress_shouldReturnACompressedVersionOfTheTwoCommands() {
    PclCommand command =
        new PclCommandBuilder()
            .p(LOWEST_PARAMETERIZED_BYTE)
            .g(LOWEST_GROUP_BYTE)
            .v("1")
            .t(LOWEST_TERMINATION_BYTE)
            .toCommand();

    ParameterizedCommand expectedCompressedCommand =
        new ParameterizedCommand(
            new byte[] {
              ESCAPE,
              LOWEST_PARAMETERIZED_BYTE,
              LOWEST_GROUP_BYTE,
              '1',
              LOWEST_PARAMETER_BYTE,
              '1',
              LOWEST_TERMINATION_BYTE
            });

    PclCommand compressedCommand = compressor.compress(command, command);

    assertNotNull(compressedCommand);
    assertEquals(expectedCompressedCommand, compressedCommand);
  }
Exemplo n.º 2
0
  @Test(expected = IllegalArgumentException.class)
  public void compress_shouldBlowUpIfTheCommandsCanNotBeCompressed() {
    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();

    compressor.compress(command, otherCommand);
  }