@Test public void testGetDecorationForNull() throws JAXBException, IOException { List<ServiceDecorationType> elements = new DecorationParser().getDecorations(null); Assert.assertEquals(0, elements.size()); }
List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); InputStream is = resourceURL.openStream(); Source source = new StreamSource(is); JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class); ServiceDecorationsType decorations = jaxb.getValue(); return decorations.getServiceDecoration(); }
DecorationParser { List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); InputStream is = resourceURL.openStream(); Source source = new StreamSource(is); JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class); ServiceDecorationsType decorations = jaxb.getValue(); return decorations.getServiceDecoration(); } }
DecorationParser { List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); InputStream is = resourceURL.openStream(); Source source = new StreamSource(is); JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class); ServiceDecorationsType decorations = jaxb.getValue(); return decorations.getServiceDecoration(); } DecorationParser(); }
DecorationParser { List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); InputStream is = resourceURL.openStream(); Source source = new StreamSource(is); JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class); ServiceDecorationsType decorations = jaxb.getValue(); return decorations.getServiceDecoration(); } DecorationParser();  }
DecorationParser { List<ServiceDecorationType> getDecorations(URL resourceURL) throws JAXBException, IOException { if (resourceURL == null || !decorationType(resourceURL)) { return new ArrayList<>(); } Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(schema); InputStream is = resourceURL.openStream(); Source source = new StreamSource(is); JAXBElement<ServiceDecorationsType> jaxb = unmarshaller.unmarshal(source, ServiceDecorationsType.class); ServiceDecorationsType decorations = jaxb.getValue(); return decorations.getServiceDecoration(); } DecorationParser();   }