package malva.java.io;

import malva.TestCase;

import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

public class PrintStreamTest extends TestCase {
  public static void testConstructor() throws UnsupportedEncodingException {
   final OutputStream out = new ByteArrayOutputStream();
/* @since 1.5
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((File) null);
      }
    }, NullPointerException.class);
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((File) null, "utf-8");
      }
    }, NullPointerException.class);
*/
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((OutputStream) null);
      }
    }, NullPointerException.class);
    assertNotNull(new PrintStream(out));
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((OutputStream) null, true);
      }
    }, NullPointerException.class);
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((OutputStream) null, false);
      }
    }, NullPointerException.class);
    assertNotNull(new PrintStream(out, true));
    assertThrows(new Block() {
      @Override public void run() throws UnsupportedEncodingException {
        new PrintStream((OutputStream) null, true, "utf-8");
      }
    }, NullPointerException.class);
    assertThrows(new Block() {
      @Override public void run() throws UnsupportedEncodingException {
        new PrintStream(out, true, null);
      }
    }, NullPointerException.class);
    assertThrows(new Block() {
      @Override public void run() throws UnsupportedEncodingException {
        new PrintStream(out, true, "unknown");
      }
    }, UnsupportedEncodingException.class);
    assertNotNull(new PrintStream(out, true, "utf-8"));
/* @since 1.5
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((String) null);
      }
    }, NullPointerException.class);
    assertThrows(new Block() {
      @Override public void run() {
        new PrintStream((String) null, (String) "utf-8");
      }
    }, NullPointerException.class);
*/
  }

  public static void main(String[] args) throws Exception {
    testConstructor();
  }
}

@@ -71,32 +71,91 @@
 ayOutputStream;%0A
+import java.io.File;%0Aimport java.io.FileNotFoundException;%0A
 import java.io.O
@@ -159,32 +159,32 @@
 o.OutputStream;%0A
-
 import java.io.P
@@ -423,30 +423,16 @@
 ream();%0A
-/* @since 1.5%0A
     asse
@@ -479,32 +479,61 @@
 ublic void run()
+ throws FileNotFoundException
  %7B%0A        new P
@@ -657,32 +657,91 @@
 ublic void run()
+ throws FileNotFoundException, UnsupportedEncodingException
  %7B%0A        new P
@@ -774,32 +774,32 @@
 tf-8%22);%0A      %7D%0A
+
     %7D, NullPoint
@@ -818,19 +818,16 @@
 class);%0A
-*/%0A
     asse
@@ -2049,22 +2049,8 @@
 ));%0A
-/* @since 1.5%0A
     
@@ -2101,32 +2101,61 @@
 ublic void run()
+ throws FileNotFoundException
  %7B%0A        new P
@@ -2281,32 +2281,91 @@
 ublic void run()
+ throws FileNotFoundException, UnsupportedEncodingException
  %7B%0A        new P
@@ -2409,32 +2409,32 @@
 tf-8%22);%0A      %7D%0A
+
     %7D, NullPoint
@@ -2457,11 +2457,8 @@
 s);%0A
-*/%0A
   %7D%0A

Enable PrintStream test cases