use of org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd in project cloudstack by apache.
the class ConfigurationManagerTest method searchForNetworkOfferingsTest.
@Test
public void searchForNetworkOfferingsTest() {
NetworkOfferingJoinVO forVpcOfferingJoinVO = new NetworkOfferingJoinVO();
forVpcOfferingJoinVO.setForVpc(true);
List<NetworkOfferingJoinVO> offerings = Arrays.asList(new NetworkOfferingJoinVO(), new NetworkOfferingJoinVO(), forVpcOfferingJoinVO);
Mockito.when(networkOfferingJoinDao.createSearchCriteria()).thenReturn(Mockito.mock(SearchCriteria.class));
Mockito.when(networkOfferingJoinDao.search(Mockito.any(SearchCriteria.class), Mockito.any(Filter.class))).thenReturn(offerings);
ListNetworkOfferingsCmd cmd = Mockito.spy(ListNetworkOfferingsCmd.class);
Mockito.when(cmd.getPageSize()).thenReturn(10);
assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(3));
Mockito.when(cmd.getForVpc()).thenReturn(Boolean.FALSE);
assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(2));
}
Aggregations