2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
22 package org.onap.aaf.auth.actions.test;
24 import static org.junit.Assert.*;
25 import org.junit.After;
26 import org.junit.Assert;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.mockito.Mock;
30 import org.mockito.Mockito;
31 import org.onap.aaf.auth.actions.Email;
32 import org.onap.aaf.auth.actions.Message;
33 import org.onap.aaf.auth.env.AuthzTrans;
34 import org.onap.aaf.auth.org.Organization.Identity;
35 import org.onap.aaf.auth.org.Organization;
36 import org.onap.aaf.auth.org.OrganizationException;
38 import static org.mockito.Mockito.*;
40 import java.io.FileNotFoundException;
41 import java.io.PrintStream;
42 import java.util.Collection;
43 import java.util.Hashtable;
46 import org.junit.Test;
48 public class JU_Email {
56 usersI = mock(Identity.class);
62 public void testClear() {
63 Assert.assertNotNull(email.clear());
67 public void testIndent() {
68 email.indent("indent");
72 public void testPreamble() {
73 email.preamble("format");
77 public void testAddTo() {
80 // Collection col = mock(Collection.class);
88 public void testAddCC() {
94 // public void testAdd() throws OrganizationException {
95 // email.add(usersI, true);
99 public void testSubject() {
100 email.subject("format");
101 email.subject("for%smat","format");
105 public void testSignature() {
106 email.signature("format","arg");
110 public void testMsg() {
115 public void testExec() {
116 AuthzTrans trans = mock(AuthzTrans.class);
117 Organization org = mock(Organization.class);
118 email.preamble("format");
120 email.signature("format","arg");
122 email.exec(trans, org, "text");
126 public void testLog() throws FileNotFoundException {
127 PrintStream ps = new PrintStream("test");
128 email.addTo("email");
129 email.addCC("email");
130 email.log(ps, "email");
131 email.addTo("emails");
132 email.addCC("emails");
133 email.log(ps, "emails");