This is clumsy, but it worked:

    @Test
    public void testLoadFeature() throws Exception { // NOSONAR this test has 
an assert, just not an assert sonar recognizes
        installAndAssertFeature("karaf-liquibase-sample-datasource-receiver");
        var service = 
getOsgiService(SampleLiquibaseDatasourceReceiverService.class);
        var initialAccounts = service.accounts();
        assertEquals(1, initialAccounts.size());
        var initialAccount = initialAccounts.get(0);
        assertEquals("jod", initialAccount.getUsername());
        var newAccount = Account.with().username("jad").build();
        var accountsAfterAdd = service.addAccount(newAccount);
        assertEquals(2, accountsAfterAdd.size());
        Account addedAccount = null;
        for (var a : accountsAfterAdd) {
            if ("jad".equals(a.getUsername())) {
                addedAccount = a;
            }
        }
        assertEquals(initialAccount.getId() + 1, addedAccount.getId());
        assertEquals("jad", addedAccount.getUsername());
    }

So I guess it has something to do with function scopes?

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/87sf48sl2y.fsf%40dod.no.

Reply via email to