private void buildContextBuilder(final boolean isSelectNull) {
builder = null;
selectContext = null;
keyPredicates = new ArrayList<KeyPredicate>();
GetEntityUriInfo resultsView = EasyMock.createMock(GetEntityUriInfo.class);
EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
EdmType edmType = EasyMock.createMock(EdmType.class);
EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
try {
EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);
} catch (EdmException e2) {
fail("this should not happen");
}
EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
EasyMock.replay(edmType, kpProperty, keyPredicate);
keyPredicates.add(keyPredicate);
int i = 0;
try {
List<SelectItem> selectItemList = new ArrayList<SelectItem>(2);
do {
EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
EasyMock.replay(edmMapping, edmProperty);
SelectItem selectItem = EasyMock.createMock(SelectItem.class);
EasyMock.expect(selectItem.getProperty()).andStubReturn(edmProperty);
EasyMock.replay(selectItem);
selectItemList.add(selectItem);
} while (++i < 2);
EasyMock.expect(entityType.getMapping()).andStubReturn(null);
EasyMock.expect(entityType.getName()).andStubReturn(entityTypeName);
EasyMock.replay(entityType);
EasyMock.expect(entitySet.getEntityType()).andStubReturn(entityType);
EasyMock.replay(entitySet);
EasyMock.expect(resultsView.getTargetEntitySet()).andStubReturn(entitySet);
if (isSelectNull) {
selectItemList = null;
}
EasyMock.expect(resultsView.getSelect()).andStubReturn(selectItemList);
ArrayList<KeyPredicate> arrayList = new ArrayList<KeyPredicate>();
arrayList.add(keyPredicate);
EasyMock.expect(resultsView.getKeyPredicates()).andStubReturn(arrayList);
EasyMock.replay(resultsView);
} catch (EdmException e1) {
fail("Exception not Expected");
}