]> git.mxchange.org Git - jmailer-ee.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 13 Nov 2022 16:04:57 +0000 (17:04 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 13 Nov 2022 16:04:57 +0000 (17:04 +0100)
- thrown exceptions from private methods are very hard or impossible to test

src/org/mxchange/jmailee/model/delivery/BaseMailerBean.java

index 7d16adb84202f3f9eb551c3ce267d9fa4d4531db..b35b8804c0e7f7494486a7c19d8c2916cdadcc55 100644 (file)
@@ -90,48 +90,6 @@ public abstract class BaseMailerBean extends BaseEnterpriseBean implements Deliv
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("deliverMail: emailWrapper={0},body={1},mailSession={2} - CALLED!", emailWrapper, writer, mailSession)); //NOI18N
 
-               // Are the additional properties and all parameter set?
-               if (null == this.properties) {
-                       // Nothing set
-                       throw new NullPointerException("this.properties is null"); //NOI18N
-               } else if (!this.properties.containsKey("mailer.from")) { //NOI18N
-                       // Throw exception
-                       throw new IllegalStateException("this.properties.mailer.from is not set"); //NOI18N
-               } else if (null == emailWrapper) {
-                       // Throw NPE
-                       throw new NullPointerException("emailWrapper is null"); //NOI18N
-               } else if (emailWrapper.getLocale() == null) {
-                       // Throw it again
-                       throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
-               } else if (emailWrapper.getRecipientAddress() == null) {
-                       // Throw it again
-                       throw new NullPointerException("emailWrapper.recipientAddress is null"); //NOI18N
-               } else if (emailWrapper.getTemplateName() == null) {
-                       // Throw it again
-                       throw new NullPointerException("emailWrapper.templateName is null"); //NOI18N
-               } else if (emailWrapper.getTemplateName().isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailWrapper.templateName is empty"); //NOI18N
-               } else if (emailWrapper.getTemplateVariables() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("emailWrapper.templateVariables is null"); //NOI18N
-               } else if (emailWrapper.getTemplateVariables().isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailWrapper.templateVariables is empty"); //NOI18N
-               } else if (!emailWrapper.getTemplateVariables().containsKey("baseUrl")) { //NOI18N
-                       // Not set
-                       throw new IllegalArgumentException("emailWrapper.templateVariables.baseUrl is not set"); //NOI18N
-               } else if (null == writer) {
-                       // Throw NPE
-                       throw new NullPointerException("writer is null"); //NOI18N
-               } else if (writer.toString().isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("writer.string is empty"); //NOI18N
-               } else if (null == mailSession) {
-                       // Throw NPE
-                       throw new NullPointerException("mailSession is null"); //NOI18N
-               }
-
                // Parse from address
                final Address senderAddress = new InternetAddress(this.properties.getProperty("mailer.from"));