@Test(expected = IOException.class) public void testGetClasses_Exception() throws Exception { try (InputStream in = new StreamUtilTest.ErroringInputStream()) { List<Class<?>> classes = getClasses(in); } }
public static List<Class<?>> getClasses(InputStream in) throws IOException { List<Class<?>> result = new ArrayList<Class<?>>(); List<String> lines = readResource(in); for (String clazz : lines) { try { result.add(Class.forName(clazz)); } catch (ClassNotFoundException | NoClassDefFoundError e) { traceLogging("Ignoring missing class [{}] :{}", e.getClass().getSimpleName(), e.getMessage()); } } return result; }
XStreamUtils { public static List<Class<?>> getClasses(InputStream in) throws IOException { List<Class<?>> result = new ArrayList<Class<?>>(); List<String> lines = readResource(in); for (String clazz : lines) { try { result.add(Class.forName(clazz)); } catch (ClassNotFoundException | NoClassDefFoundError e) { traceLogging("Ignoring missing class [{}] :{}", e.getClass().getSimpleName(), e.getMessage()); } } return result; } }
XStreamUtils { public static List<Class<?>> getClasses(InputStream in) throws IOException { List<Class<?>> result = new ArrayList<Class<?>>(); List<String> lines = readResource(in); for (String clazz : lines) { try { result.add(Class.forName(clazz)); } catch (ClassNotFoundException | NoClassDefFoundError e) { traceLogging("Ignoring missing class [{}] :{}", e.getClass().getSimpleName(), e.getMessage()); } } return result; }  }
XStreamUtils { public static List<Class<?>> getClasses(InputStream in) throws IOException { List<Class<?>> result = new ArrayList<Class<?>>(); List<String> lines = readResource(in); for (String clazz : lines) { try { result.add(Class.forName(clazz)); } catch (ClassNotFoundException | NoClassDefFoundError e) { traceLogging("Ignoring missing class [{}] :{}", e.getClass().getSimpleName(), e.getMessage()); } } return result; }  static String toFieldName(String xmlElementName); static String toXmlElementName(String fieldName); static Collection<String> createParentFields(Class<?> clazz, String field, String separator); static boolean setContainsAnyOf(Set<String> toCheck, Collection<String> possibles); static List<String> readResource(InputStream in); static List<Class<?>> getClasses(InputStream in); }
XStreamUtils { public static List<Class<?>> getClasses(InputStream in) throws IOException { List<Class<?>> result = new ArrayList<Class<?>>(); List<String> lines = readResource(in); for (String clazz : lines) { try { result.add(Class.forName(clazz)); } catch (ClassNotFoundException | NoClassDefFoundError e) { traceLogging("Ignoring missing class [{}] :{}", e.getClass().getSimpleName(), e.getMessage()); } } return result; }  static String toFieldName(String xmlElementName); static String toXmlElementName(String fieldName); static Collection<String> createParentFields(Class<?> clazz, String field, String separator); static boolean setContainsAnyOf(Set<String> toCheck, Collection<String> possibles); static List<String> readResource(InputStream in); static List<Class<?>> getClasses(InputStream in);  }