@Test public void testGetPorGenero() { final Function0<Integer> _function = new Function0<Integer>() { public Integer apply() { int _xblockexpression = (int) 0; { DaoCancionTestCase.this.dao.save(DaoCancionTestCase.this.cancion1); DaoCancionTestCase.this.dao.save(DaoCancionTestCase.this.cancion2); List<Cancion> canciones = DaoCancionTestCase.this.dao.getPorGenero("pop"); final List<Cancion> _converted_canciones = (List<Cancion>) canciones; int _length = ((Object[]) Conversions.unwrapArray(_converted_canciones, Object.class)).length; boolean _equals = Integer.valueOf(_length).equals(Integer.valueOf(2)); Assert.assertTrue(_equals); boolean _contains = canciones.contains(DaoCancionTestCase.this.cancion1); Assert.assertTrue(_contains); boolean _contains_1 = canciones.contains(DaoCancionTestCase.this.cancion2); Assert.assertTrue(_contains_1); _xblockexpression = 1; } return Integer.valueOf(_xblockexpression); } }; SessionManager.<Integer>runInSession(_function); }
@Test public void testSave() { final Function0<Integer> _function = new Function0<Integer>() { public Integer apply() { int _xblockexpression = (int) 0; { DaoCancionTestCase.this.dao.save(DaoCancionTestCase.this.cancion1); Integer expected = Integer.valueOf(1); List<Cancion> _all = DaoCancionTestCase.this.dao.getAll(); Integer actual = Integer.valueOf(_all.size()); Assert.assertEquals(expected, actual); _xblockexpression = 1; } return Integer.valueOf(_xblockexpression); } }; SessionManager.<Integer>runInSession(_function); }
@After public void tearDown() { final Function0<CancionDao> _function = new Function0<CancionDao>() { public CancionDao apply() { CancionDao _xblockexpression = null; { DaoCancionTestCase.this.dao.delete(DaoCancionTestCase.this.cancion1); DaoCancionTestCase.this.dao.delete(DaoCancionTestCase.this.cancion2); DaoCancionTestCase.this.dao.delete(DaoCancionTestCase.this.cancion3); DaoCancionTestCase.this.cancion1 = null; DaoCancionTestCase.this.cancion2 = null; DaoCancionTestCase.this.cancion3 = null; _xblockexpression = DaoCancionTestCase.this.dao = null; } return _xblockexpression; } }; SessionManager.<CancionDao>runInSession(_function); }