/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apache.river.api.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.rmi.UnmarshalException;
import static org.junit.Assert.*;
import org.junit.Test;
import tests.support.Have;

/**
 *
 * @author peter
 */
public class AtomicMarshalInputStreamTest {
  
    /**
     * Test of available method, of class AtomicMarshalInputStream.
     */
    @Test
    public void testReadObject() throws Exception {
	System.out.println("available");
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new AtomicMarshalOutputStream(baos, null);
	Have expResult = Have.SERVICE;
	oos.writeObject(expResult);
	oos.flush();
	byte [] bits = baos.toByteArray();
	ByteArrayInputStream bais = new ByteArrayInputStream(bits);
	ObjectInputStream instance = AtomicMarshalInputStream.create(bais, null, false, null, null);
	Have result = (Have) instance.readObject();
	assertEquals(expResult, result);
    }
    
    @Test
    public void testException() throws Exception {
	System.out.println("Exception test");
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	ObjectOutputStream oos = new AtomicMarshalOutputStream(baos, null);
	UnmarshalException ue = new UnmarshalException("Synthetic");
	oos.writeObject(ue);
	oos.flush();
	byte [] bits = baos.toByteArray();
	ByteArrayInputStream bais = new ByteArrayInputStream(bits);
	ObjectInputStream in = AtomicMarshalInputStream.create(bais, null, false, null, null);
	UnmarshalException ue2 = (UnmarshalException) in.readObject();
	assertEquals(ue.getMessage(), ue2.getMessage());
    }
    

}

@@ -410,43 +410,10 @@
 n;%0D%0A
-import static org.junit.Assert.*;
 %0D%0A
+
 impo
@@ -462,16 +462,64 @@
 ave;%0D%0A%0D%0A
+import static org.junit.Assert.assertEquals;%0D%0A%0D%0A
 /**%0D%0A *%0D
@@ -591,99 +591,12 @@
  %7B%0D%0A
+
   %0D%0A
-    /**%0D%0A     * Test of available method, of class AtomicMarshalInputStream.%0D%0A     */%0D%0A
     

fix javadoc errors - remove uninformative, incomplete comment.