use of org.apache.cloudstack.region.RegionService in project cloudstack by apache.
the class RegionCmdTest method testCreateFailure.
@Test
public void testCreateFailure() {
RegionService regionService = Mockito.mock(RegionService.class);
Region region = Mockito.mock(Region.class);
Mockito.when(regionService.addRegion(anyInt(), anyString(), isNull())).thenReturn(null);
addRegionCmd._regionService = regionService;
try {
addRegionCmd.execute();
} catch (ServerApiException exception) {
assertEquals("Failed to add Region", exception.getDescription());
}
}
use of org.apache.cloudstack.region.RegionService in project cloudstack by apache.
the class RegionCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
RegionService regionService = Mockito.mock(RegionService.class);
Region region = Mockito.mock(Region.class);
Mockito.when(regionService.addRegion(anyInt(), anyString(), isNull())).thenReturn(region);
addRegionCmd._regionService = regionService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
RegionResponse regionResponse = Mockito.mock(RegionResponse.class);
Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn(regionResponse);
addRegionCmd._responseGenerator = responseGenerator;
addRegionCmd.execute();
}
Aggregations