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 edmType1 = EasyMock.createMock(EdmType.class);
EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
try {
EasyMock.expect(mapping.getInternalName()).andStubReturn("Field1");
EasyMock.expect(kpProperty.getMapping()).andStubReturn(mapping);
EasyMock.expect(kpProperty.getType()).andStubReturn(edmType1);
} catch (EdmException e2) {
fail("this should not happen");
}
EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
EasyMock.replay(mapping, edmType1, kpProperty, keyPredicate);
keyPredicates.add(keyPredicate);
int i = 0;
List<OrderExpression> orderList = new ArrayList<OrderExpression>(2);
do {
EdmType edmType = EasyMock.createMock(EdmType.class);
try {
EasyMock.expect(edmType.getName()).andStubReturn(fields[i]);
EasyMock.replay(edmType);
} catch (EdmException e2) {
fail("Exception not Expected");
}
PropertyExpression commonExpression = EasyMock.createMock(PropertyExpression.class);
EasyMock.expect(commonExpression.getEdmType()).andStubReturn(edmType);
EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
try {
EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
} catch (EdmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EasyMock.expect(commonExpression.getEdmProperty()).andStubReturn(edmTyped);
OrderExpression order = EasyMock.createMock(OrderExpression.class);
EasyMock.expect(order.getExpression()).andStubReturn(commonExpression);
EasyMock.expect(order.getSortOrder()).andStubReturn(orderType[i]);
EasyMock.replay(edmMapping, edmTyped, commonExpression);
EasyMock.replay(order);
orderList.add(order);
} while (++i < 2);
OrderByExpression orderBy = EasyMock.createMock(OrderByExpression.class);
EasyMock.expect(orderBy.getOrders()).andStubReturn(orderList);
EasyMock.replay(orderBy);
try {
i = 0;
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);