private QueryInterfaceService service;
@Before
public void setup() {
this.service = new QueryInterfaceService();
EngineeringDatabaseService edbService = mock(EngineeringDatabaseService.class);
EDBObject edbObject = new EDBObject("testoid");
edbObject.putEDBObjectEntry("id", "testid");
edbObject.putEDBObjectEntry("date", new Date());
edbObject.putEDBObjectEntry("name", "testname");
edbObject.putEDBObjectEntry("enumeration", "A", ENUM.class);
edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 0), "blub");
edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 1), "blab");
edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 2), "blob");
edbObject.putEDBObjectEntry("sub", "suboid1", SubModel.class);
edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 0), "suboid2", SubModel.class);
edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 1), "suboid3", SubModel.class);
edbObject.putEDBObjectEntry("number", Integer.valueOf(42));
edbObject.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel.class.getName());
EDBObject edbObjectImpl = new EDBObject("testoidimpl");
edbObjectImpl.putEDBObjectEntry("id", "testid");
edbObjectImpl.putEDBObjectEntry("date", new Date());
edbObjectImpl.putEDBObjectEntry("name", "testname");
edbObjectImpl.putEDBObjectEntry("enumeration", "A", ENUM.class);
edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 0), "blub");
edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 1), "blab");
edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 2), "blob");
edbObjectImpl.putEDBObjectEntry("sub", "suboid1", SubModel.class);
edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 0), "suboid2", SubModel.class);
edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 1), "suboid3", SubModel.class);
edbObjectImpl.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel2.class.getName());
EDBObject mapTest = new EDBObject("mapoid");
mapTest.putEDBObjectEntry("id", "testid");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 0), "keyA");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 0), "valueA");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 1), "keyB");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 1), "valueB");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 2), "keyC");
mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 2), "valueC");
mapTest.putEDBObjectEntry("number", Integer.valueOf(42));
mapTest.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel.class.getName());
EDBObject subObject1 = new EDBObject("suboid1");
subObject1.putEDBObjectEntry("id", "testid");
subObject1.putEDBObjectEntry("value", "testvalue");
subObject1.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());
EDBObject subObject2 = new EDBObject("suboid2");
subObject2.putEDBObjectEntry("id", "AAAAA");
subObject2.putEDBObjectEntry("value", "BBBBB");
subObject2.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());
EDBObject subObject3 = new EDBObject("suboid3");
subObject3.putEDBObjectEntry("id", "CCCCC");
subObject3.putEDBObjectEntry("value", "DDDDD");
subObject3.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());
when(edbService.getObject(eq("testoid"), anyLong())).thenReturn(edbObject);
when(edbService.getObject(eq("testoidimpl"), anyLong())).thenReturn(edbObjectImpl);
when(edbService.getObject(eq("mapoid"), anyLong())).thenReturn(mapTest);
when(edbService.getObject(eq("suboid1"), anyLong())).thenReturn(subObject1);
when(edbService.getObject(eq("suboid2"), anyLong())).thenReturn(subObject2);
when(edbService.getObject(eq("suboid3"), anyLong())).thenReturn(subObject3);
when(edbService.getObject("testoid")).thenReturn(edbObject);
when(edbService.getObject("testoidimpl")).thenReturn(edbObjectImpl);
when(edbService.getObject("mapoid")).thenReturn(mapTest);
when(edbService.getObject("suboid1")).thenReturn(subObject1);
when(edbService.getObject("suboid2")).thenReturn(subObject2);
when(edbService.getObject("suboid3")).thenReturn(subObject3);
service.setEdbService(edbService);
service.setEdbConverter(new EDBConverter(edbService));
List<QueryParser> parsers = new ArrayList<>();
parsers.add(new DefaultQueryParser());