use of java.io.NotActiveException in project jPOS by jpos.
the class TransactionManagerTest method testPrepareThrowsNullPointerException5.
@Test
public void testPrepareThrowsNullPointerException5() throws Throwable {
LogEvent evt = new LogEvent("testTransactionManagerTag");
List<TransactionParticipant> members = new ArrayList();
List<TransactionParticipant> arrayList = new ArrayList();
boolean abort = arrayList.add(new Trace());
try {
transactionManager.prepare(1, 100L, new NotActiveException(), members, arrayList.iterator(), abort, evt, null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size());
assertEquals("evt.payLoad.get(0)", "prepareForAbort: org.jpos.transaction.participant.Trace", evt.getPayLoad().get(0));
assertNull("ex.getMessage()", ex.getMessage());
assertNull("transactionManager.psp", transactionManager.psp);
assertNull("transactionManager.groups", transactionManager.groups);
assertEquals("(ArrayList) members.size()", 0, members.size());
}
}
use of java.io.NotActiveException in project jPOS by jpos.
the class TransactionManagerTest method testAbortThrowsNullPointerException.
@Test
public void testAbortThrowsNullPointerException() throws Throwable {
LogEvent evt = new LogEvent("testTransactionManagerTag");
try {
transactionManager.abort(1, 100L, new NotActiveException("testTransactionManagerParam1"), members, members.add(null), evt, null);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("(ArrayList) members.size()", 1, members.size());
}
}
use of java.io.NotActiveException in project jPOS by jpos.
the class BSHTransactionParticipantTest method testPrepare.
@Test
public void testPrepare() throws Throwable {
int result = new BSHTransactionParticipant().prepare(100L, new NotActiveException());
assertEquals("result", 129, result);
}
use of java.io.NotActiveException in project j2objc by google.
the class OldObjectOutputStreamTest method test_putFields.
public void test_putFields() throws Exception {
/*
* "SerializableTestHelper" is an object created for these tests with
* two fields (Strings) and simple implementations of readObject and
* writeObject which simply read and write the first field but not the
* second one.
*/
SerializableTestHelper sth;
try {
oos.putFields();
fail("Test 1: NotActiveException expected.");
} catch (NotActiveException e) {
// Expected.
}
oos.writeObject(new SerializableTestHelper("Gabba", "Jabba"));
oos.flush();
ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
sth = (SerializableTestHelper) (ois.readObject());
assertEquals("Test 2: readFields or writeFields failed; first field not set.", "Gabba", sth.getText1());
assertNull("Test 3: readFields or writeFields failed; second field should not have been set.", sth.getText2());
}
use of java.io.NotActiveException in project jPOS by jpos.
the class TransactionManagerTest method testAbort6.
@Test
public void testAbort6() throws Throwable {
LogEvent evt = new LogEvent();
transactionManager.abort(1, 100L, new NotActiveException(), members, true, evt, null);
assertEquals("(ArrayList) members.size()", 0, members.size());
}
Aggregations