### Question:
PrincipalMethodArgumentResolver implements HandlerMethodArgumentResolver { @Override public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception { Principal user = ((WampMessage) message).getPrincipal(); if (user == null) { throw new MessageHandlingException(message, "No \"PRINCIPAL\" header in message"); } return user; }  @Override boolean supportsParameter(MethodParameter parameter); @Override Object resolveArgument(MethodParameter parameter, Message<?> message);  }### Answer:
@Test public void resolveArgumentTest() throws Exception { CallMessage callMessage = new CallMessage(1, "call"); TestPrincipal testPrincipal = new TestPrincipal("testPrincipal"); callMessage.setHeader(WampMessageHeader.PRINCIPAL, testPrincipal); assertThat(this.resolver.resolveArgument(this.principalParameter, callMessage)) .isEqualTo(testPrincipal); }
@Test(expected = MessageHandlingException.class) public void missingPrincipalTest() throws Exception { CallMessage callMessage = new CallMessage(1, "call"); TestPrincipal testPrincipal = new TestPrincipal("testPrincipal"); assertThat(this.resolver.resolveArgument(this.principalParameter, callMessage)) .isEqualTo(testPrincipal); }