@Test public void testFilterMethodCoupling() { assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder().build(), DEFAULT_COUPLING)).isTrue(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .include(new CouplingFilter.Builder() .sourcePackage("^com\\.foo$") .targetPackage("^com\\.bar$") .build()) .build(), DEFAULT_COUPLING)).isTrue(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .exclude(new CouplingFilter.Builder() .sourcePackage("^com\\.bar$") .targetPackage("^com\\.foo$") .build()) .build(), DEFAULT_COUPLING)).isTrue(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .exclude(new CouplingFilter.Builder() .sourcePackage("^com\\.foo$") .targetPackage("^com\\.bar$") .build()) .build(), DEFAULT_COUPLING)).isFalse(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .include(new CouplingFilter.Builder() .sourcePackage("^com\\.bar$") .targetPackage("^com\\.foo$") .build()) .build(), DEFAULT_COUPLING)).isFalse(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .include(new CouplingFilter.Builder() .sourcePackage("^[\\w\\.]+$") .build()) .exclude(new CouplingFilter.Builder() .targetPackage("^[\\d\\.]+$") .build()) .build(), DEFAULT_COUPLING)).isTrue(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .include(new CouplingFilter.Builder() .sourcePackage("^[\\d\\.]+$") .build()) .exclude(new CouplingFilter.Builder() .targetPackage("^[\\w\\.]+$") .build()) .build(), DEFAULT_COUPLING)).isFalse(); assertThat(filterMethodCoupling(new CouplingFilterConfig.Builder() .include(new CouplingFilter.Builder() .sourcePackage("^[\\w\\.]+$") .build()) .exclude(new CouplingFilter.Builder() .targetPackage("^[\\w\\.]+$") .build()) .build(), DEFAULT_COUPLING)).isFalse(); }
public static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig, final MethodCoupling coupling) { return couplingFilterConfig.getInclude() .map(f -> matchCoupling(f, coupling)) .orElse(true) && !couplingFilterConfig.getExclude() .map(f -> matchCoupling(f, coupling)) .orElse(false); }
CouplingFilterUtils { public static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig, final MethodCoupling coupling) { return couplingFilterConfig.getInclude() .map(f -> matchCoupling(f, coupling)) .orElse(true) && !couplingFilterConfig.getExclude() .map(f -> matchCoupling(f, coupling)) .orElse(false); } }
CouplingFilterUtils { public static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig, final MethodCoupling coupling) { return couplingFilterConfig.getInclude() .map(f -> matchCoupling(f, coupling)) .orElse(true) && !couplingFilterConfig.getExclude() .map(f -> matchCoupling(f, coupling)) .orElse(false); } private  CouplingFilterUtils(); }
CouplingFilterUtils { public static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig, final MethodCoupling coupling) { return couplingFilterConfig.getInclude() .map(f -> matchCoupling(f, coupling)) .orElse(true) && !couplingFilterConfig.getExclude() .map(f -> matchCoupling(f, coupling)) .orElse(false); } private  CouplingFilterUtils(); static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig,
                                               final MethodCoupling coupling); }
CouplingFilterUtils { public static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig, final MethodCoupling coupling) { return couplingFilterConfig.getInclude() .map(f -> matchCoupling(f, coupling)) .orElse(true) && !couplingFilterConfig.getExclude() .map(f -> matchCoupling(f, coupling)) .orElse(false); } private  CouplingFilterUtils(); static boolean filterMethodCoupling(final CouplingFilterConfig couplingFilterConfig,
                                               final MethodCoupling coupling);  }