### Question:
ConnectionSubjectResolver implements SubjectResolver { @Override public Subject getSubject() { Subject subject = securityContext.getSubject(); if (subject != null) { return subject; } String msg = "There is no Subject available in the SecurityContext. Ensure " + "that the SubjectPlugin is configured before all other Shiro-dependent broker filters."; throw new IllegalStateException(msg); } ConnectionSubjectResolver(ConnectionContext connCtx);  ConnectionSubjectResolver(ConnectionReference conn); @Override Subject getSubject();  }### Answer:
@Test(expected = IllegalStateException.class) public void testNullSubject() { SubjectConnectionReference reference = new SubjectConnectionReference(new ConnectionContext(), new ConnectionInfo(), new DefaultEnvironment(), new SubjectAdapter()); reference.getConnectionContext().setSecurityContext(new SubjectSecurityContext(reference) { @Override public Subject getSubject() { return null; } }); ConnectionSubjectResolver resolver = new ConnectionSubjectResolver(reference); resolver.getSubject(); }