@SuppressWarnings("unchecked")
@Test(expected=InternalServerErrorException.class)
public void testCreatePaymenttypeFailure() throws Exception {

    // Create the resource that is to be tested
    AdminPaymenttype resource = new AdminPaymenttype();
    // Inject fake OSGi service UkelonnService
    UkelonnServiceProvider ukelonn = new UkelonnServiceProvider();
    resource.ukelonn = ukelonn;
    // Inject a fake OSGi log service
    MockLogService logservice = new MockLogService();
    ukelonn.setLogservice(logservice);
    resource.logservice = logservice;
    // Create a mock database that throws exceptions and inject it
    DataSource datasource = mock(DataSource.class);
    Connection connection = mock(Connection.class);
    when(datasource.getConnection()).thenReturn(connection);
    PreparedStatement statement = mock(PreparedStatement.class);
    when(connection.prepareStatement(anyString())).thenReturn(statement);
    when(statement.executeUpdate()).thenThrow(SQLException.class);
    ukelonn.setDataSource(datasource);
    // Create new payment type
    TransactionType paymenttype = new TransactionType(-2001, "Bar", 0.0, false, true);
    // Try update the jobtype in the database, which should cause an
    // "500 Internal Server Error" exception
    resource.create(paymenttype);
    fail("Should never get here!");
}