package de.flux.playground.deckcompare.importer;

import static java.lang.String.format;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import org.apache.commons.lang3.Validate;

import de.flux.playground.deckcompare.dto.Deck;

public class DeckImporter {

    public Deck importDeck(URL url) {
        Validate.notNull(url);

        try {
            return importDeck(new File(url.toURI()));
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(format("The provided URL '%s' cannot be converted to a URI.", url), e);
        }
    }

    public Deck importDeck(File file) {
        Deck deck = new Deck();
        try {
            JAXBContext jaxbContext = JAXBContext.newInstance(Deck.class);

            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            deck = (Deck) jaxbUnmarshaller.unmarshal(file);

        } catch (JAXBException e) {
            e.printStackTrace();
        }

        return deck;
    }

}

@@ -81,16 +81,73 @@
 .format;
+%0Aimport static org.apache.commons.lang3.Validate.notNull;
 %0A%0Aimport
@@ -332,51 +332,8 @@
 r;%0A%0A
-import org.apache.commons.lang3.Validate;%0A%0A
 impo
@@ -452,25 +452,16 @@
         
-Validate.
 notNull(
@@ -708,24 +708,24 @@
    %7D%0A    %7D%0A%0A
-
     public D
@@ -748,24 +748,48 @@
 ile file) %7B%0A
+        notNull(file);%0A%0A
         Deck

Add not null validation