Search in sources :

Example 16 with ObjectOutput

use of java.io.ObjectOutput in project jPOS by jpos.

the class ISOAmountTest method testBadWriteAttemptISOException.

@Test
public void testBadWriteAttemptISOException() throws IOException {
    iSOAmount = new ISOAmount() {

        @Override
        public Object getValue() throws ISOException {
            throw new ISOException("boo!");
        }
    };
    ObjectOutput oo = mock(ObjectOutput.class);
    try {
        iSOAmount.writeExternal(oo);
    } catch (IOException ioe) {
        assertThat(ioe.getMessage(), is("org.jpos.iso.ISOException: boo!"));
    }
}
Also used : ObjectOutput(java.io.ObjectOutput) IOException(java.io.IOException) Test(org.junit.Test)

Example 17 with ObjectOutput

use of java.io.ObjectOutput in project jPOS by jpos.

the class ISOFieldPackagerTest method testPackThrowsNullPointerException.

@SuppressWarnings("deprecation")
@Test
public void testPackThrowsNullPointerException() throws Throwable {
    ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream());
    try {
        new IF_ECHAR(100, "testISOFieldPackagerDescription").pack(new ISOField(), out);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ObjectOutput(java.io.ObjectOutput) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Test(org.junit.Test)

Example 18 with ObjectOutput

use of java.io.ObjectOutput in project jPOS by jpos.

the class ISOFieldTest method testWriteExternal.

@Test
public void testWriteExternal() throws Throwable {
    ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream());
    new ISOVField(new ISOField(100, "testISOFieldv"), new ISOVError("testISOFieldDescription", "testISOFieldRejectCode")).writeExternal(out);
}
Also used : ObjectOutput(java.io.ObjectOutput) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Test(org.junit.Test)

Example 19 with ObjectOutput

use of java.io.ObjectOutput in project jPOS by jpos.

the class ISOFieldTest method testWriteExternalThrowsNullPointerException.

@Test
public void testWriteExternalThrowsNullPointerException() throws Throwable {
    ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream());
    try {
        new ISOField(100).writeExternal(out);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ObjectOutput(java.io.ObjectOutput) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Test(org.junit.Test)

Example 20 with ObjectOutput

use of java.io.ObjectOutput in project jPOS by jpos.

the class ISOMsg2Test method testWriteExternal.

@Test
public void testWriteExternal() throws Throwable {
    ObjectOutput out = new ObjectOutputStream(new ByteArrayOutputStream());
    ISOMsg iSOMsg = new ISOMsg("testISOMsgMti");
    iSOMsg.setPackager(new GenericPackager());
    iSOMsg.writeExternal(out);
    assertNull("iSOMsg.header", iSOMsg.header);
// int actual = ;
}
Also used : ObjectOutput(java.io.ObjectOutput) GenericPackager(org.jpos.iso.packager.GenericPackager) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) Test(org.junit.Test)

Aggregations

ObjectOutput (java.io.ObjectOutput)105 ObjectOutputStream (java.io.ObjectOutputStream)78 ByteArrayOutputStream (java.io.ByteArrayOutputStream)64 IOException (java.io.IOException)53 ObjectInput (java.io.ObjectInput)26 Test (org.junit.Test)24 ObjectInputStream (java.io.ObjectInputStream)20 ByteArrayInputStream (java.io.ByteArrayInputStream)19 WorkingMemory (org.drools.core.WorkingMemory)13 FileOutputStream (java.io.FileOutputStream)12 RuleImpl (org.drools.core.definitions.rule.impl.RuleImpl)12 Pattern (org.drools.core.rule.Pattern)12 Consequence (org.drools.core.spi.Consequence)12 KnowledgeHelper (org.drools.core.spi.KnowledgeHelper)12 OutputStream (java.io.OutputStream)11 InternalWorkingMemory (org.drools.core.common.InternalWorkingMemory)8 Declaration (org.drools.core.rule.Declaration)8 IntrospectionException (java.beans.IntrospectionException)7 File (java.io.File)7 InvalidRuleException (org.drools.core.rule.InvalidRuleException)7