@Test public void one_mapping_containing_two_entries_transformed_to_config() { ScanMapping mapping1 = createMapping("id1",new MappingEntry("pattern1","replacement1","comment1"),new MappingEntry("pattern2","replacement2","comment2")); ScanConfig result = transformerToTest.transform(Collections.singletonList(mapping1)); assertNotNull(result); assertEquals(1, result.getNamePatternMappings().size()); List<NamePatternToIdEntry> namePatternList = result.getNamePatternMappings().get("id1"); assertEquals(2,namePatternList.size()); NamePatternToIdEntry first = namePatternList.get(0); assertEquals("pattern1", first.getNamePattern()); assertEquals("replacement1", first.getId()); NamePatternToIdEntry second = namePatternList.get(1); assertEquals("pattern2", second.getNamePattern()); assertEquals("replacement2", second.getId()); }
public ScanConfig transform(List<ScanMapping> mappings) { ScanConfig config = new ScanConfig(); if (mappings==null || mappings.size()==0) { return config; } for (ScanMapping mapping: mappings) { MappingData data = MappingData.fromString(mapping.getData()); config.getNamePatternMappings().put(mapping.getId(), convert(data)); } return config; }
ScanMappingToScanConfigTransformer { public ScanConfig transform(List<ScanMapping> mappings) { ScanConfig config = new ScanConfig(); if (mappings==null || mappings.size()==0) { return config; } for (ScanMapping mapping: mappings) { MappingData data = MappingData.fromString(mapping.getData()); config.getNamePatternMappings().put(mapping.getId(), convert(data)); } return config; } }
ScanMappingToScanConfigTransformer { public ScanConfig transform(List<ScanMapping> mappings) { ScanConfig config = new ScanConfig(); if (mappings==null || mappings.size()==0) { return config; } for (ScanMapping mapping: mappings) { MappingData data = MappingData.fromString(mapping.getData()); config.getNamePatternMappings().put(mapping.getId(), convert(data)); } return config; }  }
ScanMappingToScanConfigTransformer { public ScanConfig transform(List<ScanMapping> mappings) { ScanConfig config = new ScanConfig(); if (mappings==null || mappings.size()==0) { return config; } for (ScanMapping mapping: mappings) { MappingData data = MappingData.fromString(mapping.getData()); config.getNamePatternMappings().put(mapping.getId(), convert(data)); } return config; }  ScanConfig transform(List<ScanMapping> mappings); }
ScanMappingToScanConfigTransformer { public ScanConfig transform(List<ScanMapping> mappings) { ScanConfig config = new ScanConfig(); if (mappings==null || mappings.size()==0) { return config; } for (ScanMapping mapping: mappings) { MappingData data = MappingData.fromString(mapping.getData()); config.getNamePatternMappings().put(mapping.getId(), convert(data)); } return config; }  ScanConfig transform(List<ScanMapping> mappings);  }