class SetCommand implements CommandRunnable {

    @Override
    public ReplyMessage run(int argc, byte[][] argv) throws Exception {
        if (argc != 3) {
            return ErrorMessage.WrongArgcMessage;
        }

        String key = new String(argv[1], Protocol.KEYCAFE_CHARSET);
        String val = new String(argv[2], Protocol.KEYCAFE_CHARSET);
        kvMap.put(key, val);
        logger.info("set key: {} - result: {}", key, val);
        tMap.put(key, System.currentTimeMillis());

        return StringMessage.OkMessage;
    }

}

class SetCommandTest {

    @Test
    public void test2() throws Exception {

        byte[][] args = new byte[2][];
        args[0] = new byte[]{(byte) Command.SET.ordinal()};
        args[1] = "abc".getBytes();
        SetCommand s = new SetCommand(null, null);
        ReplyMessage reply = s.run(2, args);
        assertEquals(reply, ErrorMessage.WrongArgcMessage);
    }

}