@Test
public void testCreatePaymenttype() {

    // Create the resource that is to be tested
    AdminPaymenttype resource = new AdminPaymenttype();
    // Inject fake OSGi service UkelonnService
    UkelonnService ukelonn = mock(UkelonnService.class);
    resource.ukelonn = ukelonn;
    // Get the list of payment types before adding a new job type
    List<TransactionType> originalPaymenttypes = getPaymenttypes();
    List<TransactionType> newPaymenttypes = new ArrayList<>(originalPaymenttypes);
    // Create new payment type
    TransactionType paymenttype = new TransactionType(-2001, "Bar", 0.0, false, true);
    newPaymenttypes.add(paymenttype);
    when(ukelonn.createPaymenttype(any())).thenReturn(newPaymenttypes);
    // Add the payment type to the database
    List<TransactionType> updatedPaymenttypes = resource.create(paymenttype);
    // Verify that a new jobtype has been added
    assertThat(updatedPaymenttypes.size()).isGreaterThan(originalPaymenttypes.size());
}