MappingValidator { public static URL validateURL(String fileName, BeanContainer beanContainer) { DozerClassLoader classLoader = beanContainer.getClassLoader(); if (fileName == null) { MappingUtils.throwMappingException("File name is null"); } URL url = classLoader.loadResource(fileName); if (url == null) { DozerClassLoader tccl = beanContainer.getTCCL(); url = tccl.loadResource(fileName); if (url == null) { MappingUtils.throwMappingException("Unable to locate dozer mapping file [" + fileName + "] in the classpath!"); } } InputStream stream = null; try { stream = url.openStream(); } catch (IOException e) { MappingUtils.throwMappingException("Unable to open URL input stream for dozer mapping file [" + url + "]"); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { MappingUtils.throwMappingException("Unable to close input stream for dozer mapping file [" + url + "]"); } } } return url; } private  MappingValidator(); static void validateMappingRequest(Object srcObj); static void validateMappingRequest(Object srcObj, Object destObj); static void validateMappingRequest(Object srcObj, Class<?> destClass); static URL validateURL(String fileName, BeanContainer beanContainer);  }
@Test(expected = MappingException.class) public void testValidtateMappingURL_InvalidFileName() { MappingValidator.validateURL("hello", beanContainer); }
@Test(expected = MappingException.class) public void testValidtateMappingURL_NullFileName() { MappingValidator.validateURL(null, beanContainer); }