### Question:
AmqMethodRegistry { public AmqMethodBodyFactory getFactory(short classId, short methodId) throws AmqFrameDecodingException { try { AmqMethodBodyFactory factory = factories[classId][methodId]; if (factory == null) { throw new AmqFrameDecodingException(AmqConstant.COMMAND_INVALID, "Method " + methodId + " unknown in AMQP version 0-91" + " (while trying to decode class " + classId + " method " + methodId + "."); } return factory; } catch (NullPointerException e) { throw new AmqFrameDecodingException(AmqConstant.COMMAND_INVALID, "Class " + classId + " unknown in AMQP version 0-91" + " (while trying to decode class " + classId + " method " + methodId + "."); } catch (IndexOutOfBoundsException e) { if (classId >= factories.length) { throw new AmqFrameDecodingException(AmqConstant.COMMAND_INVALID, "Class " + classId + " unknown in AMQP version 0-91" + " (while trying to decode class " + classId + " method " + methodId + "."); } else { throw new AmqFrameDecodingException(AmqConstant.COMMAND_INVALID, "Method " + methodId + " unknown in AMQP version 0-91" + " (while trying to decode class " + classId + " method " + methodId + "."); } } } AmqMethodRegistry(AuthenticationStrategy authenticationStrategy); AmqMethodBodyFactory getFactory(short classId, short methodId); public AmqMethodBodyFactory[][] factories; }### Answer:
@Test(expectedExceptions = AmqFrameDecodingException.class) public void testInvalidMethodValue() throws Exception { AmqMethodBodyFactory factory = new AmqMethodRegistry(authenticationStrategy).getFactory((short) 12, (short) 12); }
@Test(expectedExceptions = AmqFrameDecodingException.class) public void testLargeMethodValue() throws Exception { AmqMethodBodyFactory factory = new AmqMethodRegistry(authenticationStrategy).getFactory((short) 10, (short) 2000); }
@Test(expectedExceptions = AmqFrameDecodingException.class) public void testLargeClassValue() throws Exception { AmqMethodBodyFactory factory = new AmqMethodRegistry(authenticationStrategy).getFactory((short) 2000, (short) 10); }
@Test(expectedExceptions = AmqFrameDecodingException.class) public void testInvalidMethodValueInValidClass() throws Exception { AmqMethodBodyFactory factory = new AmqMethodRegistry(authenticationStrategy).getFactory((short) 60, (short) 5); }