@Test @Transactional public void shouldInsertSetting() { Settings setting = getNewSetting(); DAO.saveOrUpdate(setting); assertThat(setting.getId()).isNotEqualTo(0); }
private Settings getNewSetting() { Users user = getNewUser(); DAO.saveOrUpdate(user); Settings setting = new Settings(); setting.setName("Test"); setting.setUser(user); setting.setTheLastEntry(new java.sql.Timestamp(System.currentTimeMillis())); List<SettingsConversion> scList = new ArrayList<>(); SettingsConversion sc1 = getNewSettingsConversionLine(); sc1.setLineNumber(1); sc1.setParent_id(setting); SettingsConversion sc2 = getNewSettingsConversionLine(); sc2.setLineNumber(2); sc2.setParent_id(setting); sc2.setNote("Useful"); scList.add(sc1); scList.add(sc2); setting.setConversion(scList); return setting; }