@Test public void testGetEc2OnDemandPricingEntities() { // Create database entities required for testing in random order. List<Ec2OnDemandPricingEntity> ec2OnDemandPricingEntities = Arrays .asList(ec2OnDemandPricingDaoTestHelper.createEc2OnDemandPricingEntity(AWS_REGION_NAME_2, EC2_INSTANCE_TYPE_2, HOURLY_PRICE), ec2OnDemandPricingDaoTestHelper.createEc2OnDemandPricingEntity(AWS_REGION_NAME, EC2_INSTANCE_TYPE, HOURLY_PRICE), ec2OnDemandPricingDaoTestHelper.createEc2OnDemandPricingEntity(AWS_REGION_NAME_2, EC2_INSTANCE_TYPE, HOURLY_PRICE), ec2OnDemandPricingDaoTestHelper.createEc2OnDemandPricingEntity(AWS_REGION_NAME, EC2_INSTANCE_TYPE_2, HOURLY_PRICE)); // Retrieve a list of entities and validate the result. assertEquals(Arrays .asList(ec2OnDemandPricingEntities.get(1), ec2OnDemandPricingEntities.get(3), ec2OnDemandPricingEntities.get(2), ec2OnDemandPricingEntities.get(0)), ec2OnDemandPricingDao.getEc2OnDemandPricingEntities()); } }
List<Ec2OnDemandPricingEntity> ec2OnDemandPricingEntities = ec2OnDemandPricingDao.getEc2OnDemandPricingEntities();
List<Ec2OnDemandPricingEntity> ec2OnDemandPricingEntities = ec2OnDemandPricingDao.getEc2OnDemandPricingEntities();
when(ec2OnDemandPricingDao.getEc2OnDemandPricingEntities()).thenReturn(ec2OnDemandPricingEntities); verify(ec2OnDemandPricingDao).getEc2OnDemandPricingEntities(); verify(ec2OnDemandPricingDao, times(2)).saveAndRefresh(any(Ec2OnDemandPricingEntity.class)); verify(ec2OnDemandPricingDao).delete(ec2OnDemandPricingEntities.get(0));