### Question:
InstanceOfferDao extends NamedParameterJdbcDaoSupport { public List<InstanceType> loadInstanceTypes(InstanceOfferRequestVO instanceOfferRequestVO) { MapSqlParameterSource params = new MapSqlParameterSource(); String query = wherePattern.matcher(loadInstanceTypesQuery) .replaceFirst(makeFilterCondition(instanceOfferRequestVO, params)); return getNamedParameterJdbcTemplate().query(query, params, InstanceTypeParameters.getRowMapper()); }  @Transactional(propagation = Propagation.MANDATORY) @SuppressWarnings("unchecked") void insertInstanceOffers(List<InstanceOffer> offerList); @Transactional(propagation = Propagation.MANDATORY) void removeInstanceOffers(); @Transactional(propagation = Propagation.MANDATORY) void removeInstanceOffersForRegion(Long regionId); List<InstanceOffer> loadInstanceOffers(InstanceOfferRequestVO instanceOfferRequestVO); List<InstanceType> loadInstanceTypes(InstanceOfferRequestVO instanceOfferRequestVO); List<InstanceType> loadInstanceTypes(); Date getPriceListPublishDate();  }### Answer:
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void loadInstanceTypesShouldReturnAvailableInstancesInSpecifiedRegion() { final List<InstanceType> instanceTypes = instanceOfferDao.loadInstanceTypes(offerRequest(region.getId())); assertThat(instanceTypes.size(), is(1)); final InstanceType instanceType = instanceTypes.get(0); assertThat(instanceType.getName(), is(INSTANCE_TYPE)); assertThat(instanceType.getRegionId(), is(region.getId())); }
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void loadInstanceTypesShouldReturnNoInstancesIfRequiredInstancesAreNotAvailableInSpecifiedRegion() { final List<InstanceType> instanceTypes = instanceOfferDao.loadInstanceTypes(offerRequest(region.getId(), ANOTHER_INSTANCE_TYPE)); assertThat(instanceTypes.size(), is(0)); }
@Test @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void loadInstanceTypesShouldReturnAvailableInstancesForAllRegionsIfNoRegionIsSpecified() { final List<InstanceType> instanceTypes = instanceOfferDao.loadInstanceTypes(offerRequest()); assertThat(instanceTypes.size(), is(3)); final InstanceType instanceType = instanceTypes.get(0); assertThat(instanceType.getName(), is(INSTANCE_TYPE)); final InstanceType instanceType1 = instanceTypes.get(1); assertThat(instanceType1.getName(), is(INSTANCE_TYPE)); final InstanceType instanceType2 = instanceTypes.get(2); assertThat(instanceType2.getName(), is(ANOTHER_INSTANCE_TYPE)); }