assertThat(pushApplicationDao.find(id)).isNull();
}
@Test
public void shouldCountInstallations() {
PushApplication pushApplication1 = new PushApplication();
pushApplication1.setName("Push App 1");
final String id = pushApplication1.getId();
pushApplicationDao.create(pushApplication1);
PushApplication pa = pushApplicationDao.find(id);
AndroidVariant av = new AndroidVariant();
av.setName("Android Variant");
av.setGoogleKey("KEY...");
variantDao.create(av);
iOSVariant ios = new iOSVariant();
ios.setName("spelling is hard");
ios.setPassphrase("123");
ios.setCertificate("12".getBytes());
variantDao.create(ios);
Installation androidInstallation1 = new Installation();
androidInstallation1.setDeviceToken("CSPA91bGDWDdlxW3EmSs2bH7Qlo5AOfbCJtmyOukYxVHq8KKUqpPLBLUjettGYoN2nahBbAe3GgmxKPcZnqEIFFxHw3brKOSmeXjZQuEVehSJTUdJuXUCmR3XweZ2MM455fYMcvkUse1DIp1wjxnik2uHYSNl87wrJzLddoC7tPpgch3eJAf");
installationDao.create(androidInstallation1);
Installation androidInstallation2 = new Installation();
androidInstallation2.setDeviceToken("ASPA91bGDWDdlxW3EmSs2bH7Qlo5AOfbCJtmyOukYxVHq8KKUqpPLBLUjettGYoN2nahBbAe3GgmxKPcZnqEIFFxHw3brKOSmeXjZQuEVehSJTUdJuXUCmR3XweZ2MM455fYMcvkUse1DIp1wjxnik2uHYSNl87wrJzLddoC7tPpgch3eJAf");
installationDao.create(androidInstallation2);
Installation iosInstallation1 = new Installation();
iosInstallation1.setDeviceToken("33ee51dad49a77ca7b45924074bcc4f19aea20308f5feda202fbba3baed7073d7");
installationDao.create(iosInstallation1);
androidInstallation1.setVariant(av);
androidInstallation2.setVariant(av);
iosInstallation1.setVariant(ios);
variantDao.update(av);
variantDao.update(ios);
pa.getVariants().add(av);
pa.getVariants().add(ios);
pushApplicationDao.update(pa);
// flush to be sure that it's in the database
entityManager.flush();
// clear the cache otherwise finding the entity will not perform a select but get the entity from cache