@PostConstruct public void initialize() { user = new User(); user.setName("Teste"); user.setUsername("Teste1"); user.setPassword("pass"); user.setUserApps(new ArrayList<App>()); this.userDao.create(user); }
@Test public void findByIdApp() { App app = new App(); app.setUser(user); user.getUserApps().add(app); app.setAppName("Teste"); app.setVersion("0.1"); app.setiOSTheme(false); app = this.appDao.create(app); Assert.assertEquals(app, this.appDao.findById(app.getId())); }
@Test public void deleteApp() { App app = new App(); app.setUser(user); user.getUserApps().add(app); app.setAppName("Teste"); app.setVersion("0.1"); app.setiOSTheme(false); Assert.assertEquals(0, this.appDao.findAll().size()); app = this.appDao.create(app); Assert.assertEquals(1, this.appDao.findAll().size()); this.appDao.delete(app); Assert.assertEquals(0, this.appDao.findAll().size()); Assert.assertNull(this.appDao.findById(app.getId())); }
@Test public void createAppWithEmailUs() { App app = new App(); app.setUser(user); user.getUserApps().add(app); app.setAppName("Teste"); app.setVersion("0.1"); EmailUs email = new EmailUs(); email.setEmail("email"); email.setApp(app); List<Function> function = new ArrayList<Function>(); function.add(email); app.setAppFunctions(function); app.setiOSTheme(false); app = this.appDao.create(app); Assert.assertEquals(app, this.appDao.findById(app.getId())); }