### Question:
SubjectFilter extends EnvironmentFilter { public void setSecurityContextFactory(SecurityContextFactory securityContextFactory) { if (securityContextFactory == null) { throw new IllegalArgumentException("SecurityContextFactory argument cannot be null."); } this.securityContextFactory = securityContextFactory; } SubjectFilter(); ConnectionSubjectFactory getConnectionSubjectFactory(); void setConnectionSubjectFactory(ConnectionSubjectFactory connectionSubjectFactory); SecurityContextFactory getSecurityContextFactory(); void setSecurityContextFactory(SecurityContextFactory securityContextFactory); @Override void addConnection(ConnectionContext context, ConnectionInfo info); @Override void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void setNullSecurityContextFactory() { filter.setSecurityContextFactory(null); }
@Test public void testSetSecurityContextFactory() { SecurityContextFactory factory = new SecurityContextFactory() { @Override public SecurityContext createSecurityContext(SubjectConnectionReference ref) { return null; } }; filter.setSecurityContextFactory(factory); assertSame(factory, filter.getSecurityContextFactory()); }