Technoboy- commented on a change in pull request #1529:
URL: 
https://github.com/apache/shardingsphere-elasticjob/pull/1529#discussion_r497205245



##########
File path: 
elasticjob-error-handler/elasticjob-error-handler-impl/elasticjob-error-handler-email/src/test/java/org/apache/shardingsphere/elasticjob/error/handler/email/EmailJobErrorHandlerTest.java
##########
@@ -50,4 +53,28 @@ public void assertHandleExceptionWithYAMLConfiguration() 
throws ReflectiveOperat
         assertTrue(config.isUseSsl());
         assertTrue(config.isDebug());
     }
+    
+    @Test
+    public void assertHandleExceptionWithSession() throws 
ReflectiveOperationException {
+        EmailJobErrorHandler emailJobErrorHandler = getEmailJobErrorHandler();
+        emailJobErrorHandler.handleException("test job name", new 
RuntimeException("test exception"));
+        Field field = 
emailJobErrorHandler.getClass().getDeclaredField("session");
+        field.setAccessible(true);
+        Session session = (Session) field.get(emailJobErrorHandler);
+        assertNotNull(session);
+        assertThat(session.getProperties().get("mail.smtp.host"), 
equalTo("yaml.email.com"));
+        assertThat(session.getProperties().get("mail.debug"), equalTo("true"));
+        assertThat(session.getProperties().get("mail.smtp.port"), 
equalTo(123));
+        assertThat(session.getProperties().get("mail.transport.protocol"), 
equalTo("yaml.smtp"));
+        assertThat(session.getProperties().get("mail.smtp.auth"), 
equalTo("true"));
+    }
+    
+    private EmailJobErrorHandler getEmailJobErrorHandler() {
+        for (JobErrorHandler jobErrorHandler : 
ServiceLoader.load(JobErrorHandler.class)) {

Review comment:
       rename jobErrorHandler -> each




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to