use of org.apache.cloudstack.region.dao.RegionDao in project cloudstack by apache.
the class RegionManagerTest method testUniqueName.
@Test
public void testUniqueName() {
RegionManagerImpl regionMgr = new RegionManagerImpl();
RegionDao regionDao = Mockito.mock(RegionDao.class);
RegionVO region = new RegionVO(2, "APAC", "");
Mockito.when(regionDao.findByName(Matchers.anyString())).thenReturn(region);
regionMgr._regionDao = regionDao;
try {
regionMgr.addRegion(2, "APAC", "");
} catch (InvalidParameterValueException e) {
Assert.assertEquals("Region with name: APAC already exists", e.getMessage());
}
}
Aggregations