Below code helps to find wite spock based test case
import org.springframework.beans.factory.annotation.Autowired;
import spock.lang.Specification
@ContextConfiguration(['classpath*:META-INF/spring/applicationContext.xml'])
@Transactional
class TravelDetailDaoSpec extends Specification {
@Autowired
private TravelDetailDao travelDetailDao;
def "store TravelDetail into db"() {
given:
TravelDetailVO TravelDetailVO =new TravelDetailVO();
TravelDetailVO.setId("C001");
TravelDetailVO.setPlace("vancouver");
TravelDetailVO.setCountry("canada");
when:
travelDetailDao.create(TravelDetailVO);
List<TravelDetailVO> list=travelDetailDao.getDetails("C001");
then:
assertTrue ("Saved Successfully",list.size()>0);
}
import org.springframework.beans.factory.annotation.Autowired;
import spock.lang.Specification
@ContextConfiguration(['classpath*:META-INF/spring/applicationContext.xml'])
@Transactional
class TravelDetailDaoSpec extends Specification {
@Autowired
private TravelDetailDao travelDetailDao;
def "store TravelDetail into db"() {
given:
TravelDetailVO TravelDetailVO =new TravelDetailVO();
TravelDetailVO.setId("C001");
TravelDetailVO.setPlace("vancouver");
TravelDetailVO.setCountry("canada");
when:
travelDetailDao.create(TravelDetailVO);
List<TravelDetailVO> list=travelDetailDao.getDetails("C001");
then:
assertTrue ("Saved Successfully",list.size()>0);
}
No comments:
Post a Comment