XLogUtils { public static List<String> getPkgPrefixesForCoarseMatchXLogMethods(List<XLogMethod> xLogMethods, int pkgSectionSize) { if (xLogMethods == null || xLogMethods.size() == 0) { return new ArrayList<String>(); } List<String> classNames = new ArrayList<String>(); for (XLogMethod xLogMethod : xLogMethods) { if (xLogMethod != null && xLogMethod.getClassName() != null && xLogMethod.getClassName().length() > 0) { classNames.add(xLogMethod.getClassName().replaceAll("\\$", ".")); } } return getPkgPrefixesForCoarseMatch(classNames, pkgSectionSize); } private  XLogUtils(); static Set<String> getRemainingClassNames(Set<Class<?>> classes,
            Set<String> classNames); static boolean shouldLogMember(List<XLogMethod> xLogMethods, Member member); static boolean filterResult(String className, XLogSetting xLogSetting); static List<String> getPkgPrefixesForCoarseMatch(List<String> classNames,
            int pkgSectionSize); static List<String> getPkgPrefixesForCoarseMatchXLogMethods(List<XLogMethod> xLogMethods,
            int pkgSectionSize); static final int TYPE_METHOD; static final int TYPE_CONSTRUCTOR; static final String PKG_NAME; static final String CLASS_NAME; static final String FIELD_NAME_METHODS; static final String FIELD_NAME_CLASSES; }
@Test public void testGetPkgPrefixesForCoarseMatch4() { assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(null, 1).size(), is(0)); assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(new ArrayList<XLogMethod>(), 1) .size(), is(0)); }
@Test public void testGetPkgPrefixesForCoarseMatch5() { assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(XLOG_METHODS, -1).size(), is(XLOG_METHODS.size())); assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(XLOG_METHODS, 0).size(), is(XLOG_METHODS.size())); }
@Test public void testGetPkgPrefixesForCoarseMatch6() { List<String> expected = new ArrayList<String>(); expected.add("com.promegu"); expected.add("java.lang"); expected.add("retrofit"); assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(XLOG_METHODS, 2), is(expected)); expected.clear(); expected.add("com.promegu.xlog"); expected.add("com.promegu.other"); expected.add("java.lang.Object"); expected.add("java.lang.test"); expected.add("retrofit"); assertThat(XLogUtils.getPkgPrefixesForCoarseMatchXLogMethods(XLOG_METHODS, 3), is(expected)); }