### Question:
Counter extends Applet { private void credit(APDU apdu, byte[] buffer) { short credit; if (apdu.setIncomingAndReceive() != 2) ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); credit = Util.getShort(buffer, ISO7816.OFFSET_CDATA); if (((short) (credit + balance) > MAX_BALANCE) || (credit <= 0) || (credit > MAX_CREDIT)) ISOException.throwIt(ISO7816.SW_WRONG_DATA); balance += credit; getBalance(apdu, buffer); } private  Counter(); static void install(byte[] buffer, short offset, byte length); void process(APDU apdu); static final byte INS_GET_BALANCE; static final byte INS_CREDIT; static final byte INS_DEBIT; static final short MAX_BALANCE; static final short MAX_CREDIT; static final short MAX_DEBIT; }### Answer:
@Test public void creditTest() throws CardException { sendCredit(new byte[]{0x00, 0x05}, 0x9000, new byte[]{0x00, 0x05}); assertArrayEquals(new byte[]{0x00, 0x05}, getBalance().getData()); }