Increased auth batch coverage
[aaf/authz.git] / auth / auth-batch / src / test / java / org / onap / aaf / auth / actions / test / JU_Email.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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====================================================
19  *
20  */
21
22 package org.onap.aaf.auth.actions.test;
23
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;
37
38 import static org.mockito.Mockito.*;
39
40 import java.io.FileNotFoundException;
41 import java.io.PrintStream;
42 import java.util.Collection;
43 import java.util.Hashtable;
44 import java.util.Set;
45
46 import org.junit.Test;
47
48 public class JU_Email {
49         
50         Email email;
51         Identity usersI;
52         Message msg;
53         
54         @Before
55         public void setUp() {
56                 usersI = mock(Identity.class);
57                 msg = new Message();
58                 email = new Email();
59         }
60
61         @Test
62         public void testClear() {
63                 Assert.assertNotNull(email.clear());
64         }
65         
66         @Test
67         public void testIndent() {
68                 email.indent("indent");
69         }
70         
71         @Test
72         public void testPreamble() {
73                 email.preamble("format");
74         }
75         
76         @Test
77         public void testAddTo() {
78                 email.addTo(usersI);
79                 
80 //              Collection col = mock(Collection.class);
81 //              col.add("test");
82 //              email.addTo(col);
83                 
84                 email.addTo("email");
85         }
86         
87         @Test
88         public void testAddCC() {
89                 email.addCC(usersI);
90                 email.addCC("email");
91         }
92         
93 //      @Test
94 //      public void testAdd() throws OrganizationException {
95 //              email.add(usersI, true);
96 //      }
97         
98         @Test
99         public void testSubject() {
100                 email.subject("format");
101                 email.subject("for%smat","format");
102         }
103         
104         @Test
105         public void testSignature() {
106                 email.signature("format","arg");
107         }
108         
109         @Test
110         public void testMsg() {
111                 email.msg(msg);
112         }
113         
114         @Test
115         public void testExec() {
116                 AuthzTrans trans = mock(AuthzTrans.class);
117                 Organization org = mock(Organization.class);
118                 email.preamble("format");
119                 email.msg(msg);
120                 email.signature("format","arg");
121                 
122                 email.exec(trans, org, "text");
123         }
124         
125         @Test
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");
134         }
135
136 }