final int expectedEmptyScopeCount,
final int expectedMatterScopeCount,
final int expectedLandCaseScopeCount,
final Class<? extends BusinessObject> scopedClass) {
String commentTemplate = "expected %s %s with %s scope plus %s with empty scope";
ScopedKeyValuesUif kv = new ScopedKeyValuesUif();
kv.setScopedClass(scopedClass);
MaintenanceDocumentForm form = createMockMaintenanceDocForm();
Maintainable newMaintainableObject = form.getDocument().getNewMaintainableObject();
when(newMaintainableObject.getDataObject()).thenReturn(new CourtCase());
String comment = String.format(commentTemplate, expectedCourtCaseScopeCount, dataObjectName, "court case", expectedEmptyScopeCount);
assertEquals(comment, expectedCourtCaseScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
when(newMaintainableObject.getDataObject()).thenReturn(new LandCase());
comment = String.format(commentTemplate, expectedLandCaseScopeCount, dataObjectName, "land case", expectedEmptyScopeCount);
assertEquals(comment, expectedLandCaseScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
comment = String.format(commentTemplate, expectedContractScopeCount, dataObjectName, "contract", expectedEmptyScopeCount);
when(newMaintainableObject.getDataObject()).thenReturn(new Contract());
assertEquals(comment, expectedContractScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
comment = String.format(commentTemplate, expectedMatterScopeCount, dataObjectName, "matter", expectedEmptyScopeCount);
when(newMaintainableObject.getDataObject()).thenReturn(new Matter());
assertEquals(comment, expectedMatterScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
comment = String.format(commentTemplate, expectedConveyanceScopeCount, dataObjectName, "Conveyance", expectedEmptyScopeCount);
when(newMaintainableObject.getDataObject()).thenReturn(new Conveyance());
assertEquals(comment, expectedConveyanceScopeCount + expectedEmptyScopeCount, kv.getKeyValues(form).size());
}