Commit 91ff9d3a authored by Simon Reis's avatar Simon Reis
Browse files

Tests adjusted

parent f0d2e767
......@@ -26,7 +26,7 @@ sonar.sources=src/main
sonar.exclusions=**/model/*.java,**/viewmodel/*.java, **/emails/emailTemplate.html
sonar.tests=src/test
#sonar.test.inclusions=**/*.spec.ts
sonar.test.exclusions=**/model/**,**/viewmodel/**
sonar.test.exclusions=**/model/**,**/viewmodel/**, **/emails/emailTemplate.html
#sonar.ts.tslintconfigpath=tslint.json
sonar.typescript.lcov.reportPaths=coverage/lcov.info
\ No newline at end of file
......@@ -93,12 +93,14 @@ public class EmailServiceTest {
@Test
public void testSendMail_nok() {
mailServer.stop();
emailConfig.setUseHtmlEmailTemplate(false);
MailMessageDto mailMessageDto = MockDataHelper.mockMailMessageDto();
assertThrows(MessagingException.class, () -> emailService.sendMail(mailMessageDto));
}
@Test
public void testSendMail_invalidRecipient() {
emailConfig.setHtmlEmail(false);
MailMessageDto mailMessageDto = MockDataHelper.mockMailMessageDtoWrongRecipientFormat();
assertThrows(MessagingException.class, () -> emailService.sendMail(mailMessageDto));
}
......@@ -109,6 +111,8 @@ public class EmailServiceTest {
emailConfig.setSmtpHost("localhost");
emailConfig.setEmailPort("3025");
emailConfig.setSender("testCaseSendertest.de");
emailConfig.setHtmlEmail(false);
emailConfig.setUseHtmlEmailTemplate(false);
assertThrows(MessagingException.class, () -> {
GfiEmail emailManager = new GfiEmail(emailConfig);
emailManager.sendEmail();
......
/*
*******************************************************************************
* Copyright (c) 2018 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************
*/
package org.eclipse.openk.gridfailureinformation.mailexport.util;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class ResourceLoaderBaseTest {
@Test
public void testLoadStringFromResourceNotFound() {
ResourceLoaderBase rlb = new ResourceLoaderBase();
String retString = rlb.loadStringFromResource("testNotExisting.txt");
assertNull(retString);
}
@Test
public void testLoadStringFromResource() {
ResourceLoaderBase rlb = new ResourceLoaderBase();
String retString = rlb.loadStringFromResource("testCase.txt");
assertNotNull(retString);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment