Search in sources :

Example 1 with NullTransaction

use of com.ctrip.framework.apollo.tracer.internals.NullTransaction in project apollo by ctripcorp.

the class TracerTest method testNewTransactionWithException.

@Test
public void testNewTransactionWithException() throws Exception {
    String someType = "someType";
    String someName = "someName";
    when(someProducer.newTransaction(someType, someName)).thenThrow(RuntimeException.class);
    Transaction result = Tracer.newTransaction(someType, someName);
    verify(someProducer, times(1)).newTransaction(someType, someName);
    assertTrue(result instanceof NullTransaction);
}
Also used : NullTransaction(com.ctrip.framework.apollo.tracer.internals.NullTransaction) Transaction(com.ctrip.framework.apollo.tracer.spi.Transaction) NullTransaction(com.ctrip.framework.apollo.tracer.internals.NullTransaction) Test(org.junit.Test)

Aggregations

NullTransaction (com.ctrip.framework.apollo.tracer.internals.NullTransaction)1 Transaction (com.ctrip.framework.apollo.tracer.spi.Transaction)1 Test (org.junit.Test)1