### Question:
JMS2JavaMail implements MessageListener { @PostConstruct public void init() { if (session == null) { throw new IllegalStateException("JavaMail session is null."); } javaMailSessionDelegate = new JavaMailSessionDelegate() { @Override public Transport findTransport(String protocolToUse) throws NoSuchProviderException { return session.getTransport(protocolToUse); } @Override public MimeMessage createMimeMessage(InputStream inputStream) throws MessagingException { return new MimeMessage(session, inputStream); } }; } JMS2JavaMail();   JMS2JavaMail(JavaMailSessionDelegate javaMailSessionDelegate, JavaMailJMSStatistics javaMailJMSStatistics); void onMessage(Message message); @PostConstruct void init();  }### Answer:
@Test(expected = IllegalStateException.class) public void testCheckForNullSession() throws Exception { JMS2JavaMail jms2JavaMail = new JMS2JavaMail(); jms2JavaMail.init(); }