Increased code coverage auth batch
[aaf/authz.git] / auth / auth-batch / src / test / java / org / onap / aaf / auth / actions / test / JU_Email.java
index 0779a33..70cd08a 100644 (file)
@@ -37,6 +37,7 @@ import org.onap.aaf.auth.org.OrganizationException;
 
 import static org.mockito.Mockito.*;
 
+import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
 import java.io.PrintStream;
 import java.util.Collection;
@@ -47,12 +48,21 @@ import org.junit.Test;
 
 public class JU_Email {
        
+       private ByteArrayOutputStream outStream;
+       private ByteArrayOutputStream errStream;
        Email email;
        Identity usersI;
        Message msg;
+       PrintStream ps;
        
        @Before
-       public void setUp() {
+       public void setUp() throws FileNotFoundException {
+               outStream = new ByteArrayOutputStream();
+               errStream = new ByteArrayOutputStream();
+               ps = new PrintStream(errStream);
+               System.setOut(new PrintStream(outStream));
+               System.setErr(ps);
+               
                usersI = mock(Identity.class);
                msg = new Message();
                email = new Email();
@@ -124,7 +134,6 @@ public class JU_Email {
        
        @Test
        public void testLog() throws FileNotFoundException {
-               PrintStream ps = new PrintStream("test");
                email.addTo("email");
                email.addCC("email");
                email.log(ps, "email");
@@ -132,5 +141,11 @@ public class JU_Email {
                email.addCC("emails");
                email.log(ps, "emails");
        }
+       
+       @After
+       public void cleanUp() {
+               System.setErr(System.err);
+               System.setOut(System.out);
+       }
 
 }