Change in ovirt-engine[master]: webadmin, userportal: JUnit rule for testing UiCommon models
vszocs at redhat.com
vszocs at redhat.com
Thu Aug 7 17:06:59 UTC 2014
Vojtech Szocs has submitted this change and it was merged.
Change subject: webadmin,userportal: JUnit rule for testing UiCommon models
......................................................................
webadmin,userportal: JUnit rule for testing UiCommon models
This patch adds a JUnit TestRule used to set up the necessary
UiCommon infrastructure in order to test individual UiCommon
models.
This TestRule ensures that hidden expectations of UiCommon
models (represented by static method calls) are satisfied and
provides a 'Mocks' interface for stubbing the infrastructure
behavior, if necessary.
Example - UiCommon infrastructure setup per test class:
public class MyTest {
@ClassRule
public static UiCommonSetup setup = new UiCommonSetup();
// This is optional, but often necessary
@BeforeClass
public static void stubUiCommonInfra() {
AsyncDataProvider adp = setup.getMocks().asyncDataProvider();
when(adp.isWindowsOsType(anyInt())).thenReturn(true);
}
// Actual test code to exercise model instance(s)
}
Example - UiCommon infrastructure setup per test method:
public class MyTest {
@Rule
public UiCommonSetup setup = new UiCommonSetup();
// This is optional, but often necessary
@Before
public void stubUiCommonInfra() {
AsyncDataProvider adp = setup.getMocks().asyncDataProvider();
when(adp.isWindowsOsType(anyInt())).thenReturn(true);
}
// Actual test code to exercise model instance(s)
}
Existing test code was modified to utilize UiCommonSetup rule.
Change-Id: Ifca6bf6a6b77813fa90f419ccfe2ef9f2cd09561
Signed-off-by: Vojtech Szocs <vszocs at redhat.com>
---
A frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/junit/UiCommonSetup.java
M frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseVmModelBehaviorTest.java
M frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseVmTest.java
3 files changed, 173 insertions(+), 39 deletions(-)
Approvals:
Alexander Wels: Looks good to me, approved
Allon Mureinik: Verified
Vojtech Szocs: Verified; Looks good to me, approved
--
To view, visit http://gerrit.ovirt.org/31021
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifca6bf6a6b77813fa90f419ccfe2ef9f2cd09561
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: Alexander Wels <awels at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Einav Cohen <ecohen at redhat.com>
Gerrit-Reviewer: Frank Kobzik <fkobzik at redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik at redhat.com>
Gerrit-Reviewer: Lior Vernia <lvernia at redhat.com>
Gerrit-Reviewer: Martin Betak <mbetak at redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek at redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the Engine-commits
mailing list