class JaxbLoader {

    public static MMOs loadXml(final File xmlFile)
            throws JAXBException, SAXException, ParserConfigurationException, FileNotFoundException {
        final JAXBContext jaxbContext = JAXBContext.newInstance(MMOs.class);
        final Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

        // avoid getting the DTD (was mainly for when demoing without a network, but should maybe be kept?)
        final SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setFeature("http://apache.org/xml/features/validation/schema", false);
        spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
        final XMLReader xmlReader = spf.newSAXParser().getXMLReader();
        final InputSource inputSource = new InputSource(new FileReader(xmlFile));
        final SAXSource source = new SAXSource(xmlReader, inputSource);

        return (MMOs) jaxbUnmarshaller.unmarshal(source);
    }

}

class JaxbLoaderTest {

    private static final File TEST_XML;

    @Test
    public void failToLoad() {

        //noinspection OverlyBroadCatchBlock
        try {
            JaxbLoader.loadXml(new File("noSuchFile"));
            fail("We should have had an exception before now.");
        }
        catch (final FileNotFoundException ignored) {
            // do nothing
        }
        catch (final Throwable t) {
            //noinspection CallToPrintStackTrace
            t.printStackTrace();
            fail("There should be no other throwables.");
        }
    }

}