### Question:
RegisterSet implements Target, MongoSerializable { public Register getRegister(int index) { return registers.get(index); } RegisterSet(); Register getRegister(int index); Register getRegister(String name); @Override int get(int address); @Override void set(int address, int value); void put(int index, Register register); void clear(); @Override Document mongoSerialise(); static RegisterSet deserialize(Document obj); static RegisterSet deserialize(JSONObject json); @Override String toString();  }### Answer:
@Test public void getRegister() { RegisterSet registerSet = new RegisterSet(); Register r1 = new Register("R1"); Register r2 = new Register("R2"); registerSet.put(1, r1); registerSet.put(2, r2); assertEquals(r1, registerSet.getRegister("R1")); assertEquals(r1, registerSet.getRegister(1)); assertEquals(r2, registerSet.getRegister("R2")); assertEquals(r2, registerSet.getRegister(2)); assertEquals(null, registerSet.getRegister("Unknown")); assertEquals(null, registerSet.getRegister(3)); }