@@ -0,0 +1,1790 @@
+package org.ovirt.engine.core.bll;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0Aimport org.ovirt.engine.core.common.businessentities.VmNetworkInterface;%0Aimport org.ovirt.engine.core.common.queries.GetVmTemplateParameters;%0Aimport org.ovirt.engine.core.compat.Guid;%0Aimport org.ovirt.engine.core.dao.VmNetworkInterfaceDAO;%0A%0A/**%0A * A test case for %7B@link GetTemplateInterfacesByTemplateIdQuery%7D.%0A * It does not test database implementation, but rather tests that the right delegations to the DAO occur.%0A */%0Apublic class GetTemplateInterfacesByTemplateIdQueryTest extends AbstractUserQueryTest%3CGetVmTemplateParameters, GetTemplateInterfacesByTemplateIdQuery%3CGetVmTemplateParameters%3E%3E %7B%0A    @Test%0A    public void testExecuteQuery() %7B%0A        Guid templateID = Guid.NewGuid();%0A        List%3CVmNetworkInterface%3E expectedResult = Collections.singletonList(new VmNetworkInterface());%0A%0A        GetVmTemplateParameters paramsMock = getQueryParameters();%0A        when(paramsMock.getId()).thenReturn(templateID);%0A%0A        VmNetworkInterfaceDAO vmNetworkInterfaceDAOMock = mock(VmNetworkInterfaceDAO.class);%0A        when(vmNetworkInterfaceDAOMock.getAllForTemplate(templateID, getUser().getUserId(), paramsMock.isFiltered())).thenReturn(expectedResult);%0A        when(getDbFacadeMockInstance().getVmNetworkInterfaceDAO()).thenReturn(vmNetworkInterfaceDAOMock);%0A%0A        getQuery().executeQueryCommand();%0A%0A        @SuppressWarnings(%22unchecked%22)%0A        List%3CVmNetworkInterface%3E result = (List%3CVmNetworkInterface%3E) getQuery().getQueryReturnValue().getReturnValue();%0A%0A        assertEquals(%22Wrong interfaces returned%22, expectedResult, result);%0A    %7D%0A%7D%0A

Test GetTemplateInterfacesByTemplateIdQuery