ControlSequences { public static ControlSequence createControlSequence( final byte[] controlSequences ) { return new ControlSequence() { @Override public byte[] getCommand() { return controlSequences; } }; } ControlSequences(); static ControlSequence createControlSequence( final byte[] controlSequences );  }
@Test public void testCreateControlSequence() throws Exception { final String testData = "test"; final Printer printer = TextPrinterBuilder .aPrinterBuilder() .buildPrinter( testData ); final ControlSequences controlSequences = new ControlSequences(); final byte[] codePageCommand = CodePage.CP_437_USA.getBytes( testData ); final byte[] printCommand = Print.PRINT_LINE_FEED.getCommand(); final ByteBuffer byteBuffer = ByteBuffer.allocate( codePageCommand.length + printCommand.length + 1 ); byteBuffer.put( codePageCommand ); byteBuffer.put( printCommand ); final ControlSequence controlSequence = ControlSequences.createControlSequence( byteBuffer.array() ); Assert.assertEquals( Arrays.toString( printer.getCommand() ), Arrays.toString( controlSequence.getCommand() ) ); }