Commit 76850ea6 authored by devesh bajpai's avatar devesh bajpai
Browse files

update unit test

parent 01cceaa3
Pipeline #36971 passed with stages
in 39 minutes and 48 seconds
package org.opengroup.osdu.wks.service;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
......@@ -60,14 +61,21 @@ public class MappingServiceTest {
MappingInfo mappingInfoWithHigherVersion = new MappingInfo();
mappingInfoWithHigherVersion.setId("sampleMapping");
mappingInfoWithHigherVersion.setVersion(200000);
when(mappingStore.getMappingInfo("tenant1", "entity","source", 1)).thenReturn(Collections.singletonList(
mappingInfoWithHigherVersion));
MappingInfo mappingInfoWithDIfferentId = new MappingInfo();
mappingInfoWithDIfferentId.setId("differentMapping");
mappingInfoWithDIfferentId.setVersion(200000);
List<MappingInfo> mappingInfo = Arrays.asList(mappingInfoWithDIfferentId,mappingInfoWithHigherVersion,mappingInfoWithLowerVersion);
when(mappingStore.getMappingInfo("tenant1", "entity","source", 1)).thenReturn(mappingInfo);
List<MappingInfo> mappings = mappingService.getMappingInfos("tenant1", "entity","source", 1);
assertNotNull(mappings);
//Then only one mapping is returned
assertEquals(1,mappings.size());
assertEquals(2,mappings.size());
// And returned mapping is of higher mapping version.
assertEquals("sampleMapping", mappings.get(0).getId());
assertEquals(200000, mappings.get(0).getVersion());
// And returned mapping is of higher mapping version.
assertEquals("differentMapping", mappings.get(1).getId());
assertEquals(200000, mappings.get(1).getVersion());
}
@Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment