GroupOptions groupOptions = Mockito.mock(GroupOptions.class);
Mockito.when(groupQueryMock.getGroupOptions()).thenReturn(groupOptions);
Mockito.when(groupOptions.getGroupByFunctions()).thenReturn(functionList);
Mockito.when(groupOptions.getGroupByQueries()).thenReturn(queriesList);
NamedObjectsQuery decorator = new NamedObjectsQuery(groupQueryMock);
decorator.setName(functionList.get(0), "nameFunc0");
decorator.setName(functionList.get(1), "nameFunc1");
decorator.setName(queriesList.get(0), "nameQuery0");
decorator.setName(queriesList.get(1), "nameQuery1");
Map<String, Object> objectNames = decorator.getNamesAssociation();
Assert.assertEquals(functionList.get(0), objectNames.get("nameFunc0"));
Assert.assertEquals(functionList.get(1), objectNames.get("nameFunc1"));
Assert.assertEquals(queriesList.get(0), objectNames.get("nameQuery0"));
Assert.assertEquals(queriesList.get(1), objectNames.get("nameQuery1"));