@Test public void one_mapping_containing_one_entry_transformed_to_config() { ScanMapping mapping1 = createMapping("id1",new MappingEntry("pattern1","replacement1","comment1")); ScanConfig result = transformerToTest.transform(Collections.singletonList(mapping1)); assertNotNull(result); assertEquals(1, result.getNamePatternMappings().size()); List<NamePatternToIdEntry> namePatternList = result.getNamePatternMappings().get("id1"); assertEquals(1,namePatternList.size()); NamePatternToIdEntry first = namePatternList.get(0); assertEquals("pattern1", first.getNamePattern()); assertEquals("replacement1", first.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);  }