Sculptor is an open source productivity tool. You express your design intent in a textual DSL, from which Sculptor generates high quality Java code and configuration.
public class PlanetServiceTest extends AbstractDbUnitJpaTests implements PlanetServiceTestBase { private PlanetService planetService; @Autowired public void setPlanetService(PlanetService planetService) { this.planetService = planetService; } @Test public void testFindById() throws Exception { Planet found = planetService.findById(getServiceContext(), 1L); assertEquals("Earth", found.getName()); } @Test public void testFindAll() throws Exception { List<Planet> found = planetService.findAll(getServiceContext()); assertEquals(2, found.size()); } @Test public void testSave() throws Exception { int countBefore = countRowsInTable("PLANET"); Planet planet = new Planet("Pluto"); planet.setPopulation(0L); planetService.save(getServiceContext(), planet); assertEquals(countBefore + 1, countRowsInTable("PLANET")); } @Test public void testDelete() throws Exception { int countBefore = countRowsInTable("PLANET"); Planet planet = planetService.findById(getServiceContext(), 2L); planetService.delete(getServiceContext(), planet); assertEquals(countBefore - 1, countRowsInTable("PLANET")); }}
<?xml version="1.0" encoding="UTF-8"?><dataset> <PLANET ID="1" NAME="Earth" POPULATION="7000000000" VERSION="0"/> <PLANET ID="2" NAME="Jupiter" POPULATION="0" VERSION="0"/> <MOON/></dataset>
No comments:
Post a Comment