Hi,
I'm writing a test with some inserts in the @Before and a query to find the
inserted objects (ResellerPortalIntegTest is the original
SimpleIntegTest-class):
public class ContactsTest extends ResellerPortalIntegTest {
private Role role;
private final String uniqueEmail = "[email protected]"<mailto:[email protected]>;
private final String duplicateEmail =
"[email protected]"<mailto:[email protected]>;
private final String unkownEmail =
"[email protected]"<mailto:[email protected]>;
@Before
public void setUp(){
this.role = container().newTransientInstance(Role.class);
this.role.setLabel("ROLE_ADMIN");
this.role.setDescription("(Reseller) admin");
container().persistIfNotAlready(this.role);
service(Contacts.class).create("Piet", "van de", "Pet", Gender.MALE,
"[email protected]"<mailto:[email protected]>, "pietmetpet", this.role);
service(Contacts.class).create("Jan", "van de", "Jas", Gender.MALE,
this.uniqueEmail, "janvandejas", this.role);
service(Contacts.class).create("Marie", "van de", "Markt",
Gender.FEMALE, this.duplicateEmail, "marievandemarkt", this.role);
service(Contacts.class).create("Marie", "van de", "Markt",
Gender.FEMALE, this.duplicateEmail, "marievandemarkt1", this.role);
}
@Test
public void testFindUseraccountsByEmail() throws Exception {
int expected = 1;
int actual =
wrap(service(Contacts.class)).findUseraccountsByEmail(this.uniqueEmail).size();
Assert.assertEquals(expected, actual);
}
}
The actual value is '0' while I'm sure the requested object is inserted by the
@Before-method and the query is all right.
Is this an Isis issue or do I have to look for a Datanucleus/other solution?
Thanks,
Erik