static List<ConfigProperty> convert( List<JndiBindingsType.JndiBinding.ConfigProperty> properties) { return properties.stream().map(p -> { ConfigProperty prop = new ConfigProperty(); prop.setName(p.getName()); prop.setType(p.getType()); prop.setValue(p.getValue()); return prop; }).collect(Collectors.toList()); } }
@Test public void validJson() { JndiBindingsType.JndiBinding.ConfigProperty configProperty = converter.convertFromText("{'name':'name','type':'type','value':'value'}", null, null); assertThat(configProperty.getName()).isEqualTo("name"); assertThat(configProperty.getType()).isEqualTo("type"); assertThat(configProperty.getValue()).isEqualTo("value"); }
@Test public void validWhenTypeMissing() { JndiBindingsType.JndiBinding.ConfigProperty configProperty = converter.convertFromText("{'name':'name','value':'value'}", null, null); assertThat(configProperty.getName()).isEqualTo("name"); assertThat(configProperty.getType()).isNull(); assertThat(configProperty.getValue()).isEqualTo("value"); }