@@ -0,0 +1,3011 @@
+package com.gallatinsystems.framework.dao;%0A%0Aimport com.gallatinsystems.surveyal.dao.SurveyedLocaleDao;%0Aimport com.gallatinsystems.surveyal.domain.SurveyedLocale;%0Aimport com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;%0Aimport com.google.appengine.tools.development.testing.LocalServiceTestHelper;%0Aimport org.akvo.flow.api.app.DataStoreTestUtil;%0Aimport org.junit.jupiter.api.AfterEach;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0A%0Apublic class BaseDAOTests %7B%0A    private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());%0A    private DataStoreTestUtil dataStoreTestUtil;%0A%0A    @BeforeEach%0A    public void setUp() %7B%0A        helper.setUp();%0A        dataStoreTestUtil = new DataStoreTestUtil();%0A    %7D%0A%0A    @AfterEach%0A    public void tearDown() %7B%0A        helper.tearDown();%0A    %7D%0A%0A    @Test%0A    void testRetrieveMultipleEntities() %7B%0A        Long surveyId = dataStoreTestUtil.randomId();%0A        int numberOfDataPoints = 5;%0A%0A        List%3CSurveyedLocale%3E dataPoints = dataStoreTestUtil.createDataPoints(surveyId, numberOfDataPoints);%0A        List%3CLong%3E ids = new ArrayList%3C%3E();%0A        for (SurveyedLocale datapoint : dataPoints) %7B%0A            ids.add(datapoint.getKey().getId());%0A        %7D%0A%0A        SurveyedLocaleDao slDao = new SurveyedLocaleDao();%0A        List%3CSurveyedLocale%3E retrievedDataPoints = slDao.listByKeys(ids);%0A%0A        assertEquals(5, retrievedDataPoints.size(), %22Number of retrieved datapoints should be the same as created%22);%0A    %7D%0A%0A    @Test%0A    void testRetrieveMultipleEntitiesWhenMissing() %7B%0A        Long surveyId = dataStoreTestUtil.randomId();%0A        int numberOfDataPoints = 5;%0A%0A        List%3CSurveyedLocale%3E dataPoints = dataStoreTestUtil.createDataPoints(surveyId, numberOfDataPoints);%0A        List%3CLong%3E ids = new ArrayList%3C%3E();%0A        for (SurveyedLocale datapoint : dataPoints) %7B%0A            ids.add(datapoint.getKey().getId());%0A        %7D%0A%0A        SurveyedLocaleDao slDao = new SurveyedLocaleDao();%0A        slDao.delete(dataPoints.get(0));%0A%0A        List%3CSurveyedLocale%3E retrievedDataPoints = slDao.listByKeys(ids);%0A%0A        assertEquals(4, retrievedDataPoints.size());%0A    %7D%0A%0A    @Test%0A    void testRetrieveDuplicateEntries() %7B%0A        Long surveyId = dataStoreTestUtil.randomId();%0A        int numberOfDataPoints = 5;%0A%0A        List%3CSurveyedLocale%3E dataPoints = dataStoreTestUtil.createDataPoints(surveyId, numberOfDataPoints);%0A        List%3CLong%3E ids = new ArrayList%3C%3E();%0A        for (SurveyedLocale datapoint : dataPoints) %7B%0A            ids.add(datapoint.getKey().getId());%0A        %7D%0A%0A        // add duplicate%0A        ids.add(dataPoints.get(0).getKey().getId());%0A%0A        SurveyedLocaleDao slDao = new SurveyedLocaleDao();%0A        List%3CSurveyedLocale%3E retrievedDataPoints = slDao.listByKeys(ids);%0A%0A        assertEquals(5, retrievedDataPoints.size());%0A    %7D%0A%7D%0A

Add test class for BaseDAO listKeys method * Ensure that if a list of keys is given, we remove duplicates before attempting to retrieve the entities