org.pitest.util.Glob类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.pitest.util.Glob类的一些代码示例,展示了Glob类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Glob类的具体详情如下:
包路径:org.pitest.util.Glob
类名称:Glob

Glob介绍

暂无

代码示例

代码示例来源:origin: hcoles/pitest

private static Glob glob(String match) {
 return new Glob(match);
}

代码示例来源:origin: hcoles/pitest

private Collection<Predicate<String>> globStringsToPredicates(
  final List<String> excludedMethods) {
 return FCollection.map(excludedMethods, Glob.toGlobPredicate());
}

代码示例来源:origin: hcoles/pitest

private static Predicate<MethodInfo> stringToMethodInfoPredicate(
  final Collection<String> excludedMethods) {
 final Predicate<String> excluded = Prelude.or(Glob.toGlobPredicates(excludedMethods));
 return a -> excluded.test(a.getName());
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldNotMatchIfContentDiffersBeforeAStar() {
 final Glob glob = new Glob("org.foo.*");
 assertFalse(glob.matches("org.fo"));
}

代码示例来源:origin: stackoverflow.com

public static void walk(Path start, String searchGlob) throws IOException {
  final Glob glob = new Glob(searchGlob);
  Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
    @Override
    public FileVisitResult visitFile(Path file,
        BasicFileAttributes attrs) throws IOException {
      if (glob.matchesFile(file)) {
        ...; // Process file
      }
      return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult preVisitDirectory(Path dir,
        BasicFileAttributes attrs) throws IOException {
      return glob.matchesParentDir(dir)
        ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE;
    }
  });
}

代码示例来源:origin: hcoles/pitest

@Override
public boolean test(final String value) {
 return matches(value);
}

代码示例来源:origin: hcoles/pitest

public Glob(final String glob) {
 if (glob.startsWith("~")) {
  this.regex = Pattern.compile(glob.substring(1));
 } else {
  this.regex = Pattern.compile(convertGlobToRegex(glob)
  );
 }
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldEscapeDotsInGeneratedRegex() {
 final Glob glob = new Glob("org.foo.bar");
 assertFalse(glob.matches("orgafooabar"));
}

代码示例来源:origin: org.pitest/pitest

@Override
public boolean test(final String value) {
 return matches(value);
}

代码示例来源:origin: org.pitest/pitest

public Glob(final String glob) {
 if (glob.startsWith("~")) {
  this.regex = Pattern.compile(glob.substring(1));
 } else {
  this.regex = Pattern.compile(convertGlobToRegex(glob)
  );
 }
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldSupportQuestionMarkWildCard() {
 final Glob glob = new Glob("org?foo?bar");
 assertTrue(glob.matches("org.foo.bar"));
 assertTrue(glob.matches("orgafooabar"));
}

代码示例来源:origin: hcoles/pitest

protected Collection<Predicate<String>> predicateFor(final String... glob) {
 return Glob.toGlobPredicates(Arrays.asList(glob));
}

代码示例来源:origin: hcoles/pitest

public static Function<String, Predicate<String>> toGlobPredicate() {
 return glob -> new Glob(glob);
}

代码示例来源:origin: hcoles/pitest

public static Collection<Predicate<String>> toGlobPredicates(
  final Collection<String> globs) {
 return FCollection.map(globs, Glob.toGlobPredicate());
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldMatchEverythingAfterAStar() {
 final Glob glob = new Glob("org.foo.*");
 assertTrue(glob.matches("org.foo.foo"));
 assertTrue(glob.matches("org.foo."));
 assertTrue(glob.matches("org.foo.bar"));
}

代码示例来源:origin: hcoles/pitest

IgnoreCoreClasses() {
 this.impl = Prelude.not(Prelude.or(Glob.toGlobPredicates(this.filtered)));
}

代码示例来源:origin: hcoles/pitest

@Override
 public Predicate<String> apply(String a) {
  return new Glob(a.replace(".java", "").replace("/", "."));
 }
};

代码示例来源:origin: hcoles/pitest

private Collection<Predicate<String>> determineTargetTests() {
 return FCollection.map(this.mojo.getTargetTests(), Glob.toGlobPredicate());
}

代码示例来源:origin: hcoles/pitest

@Test
public void shouldFindExactMatches() {
 final String value = "org.foo.foo";
 final Glob glob = new Glob(value);
 assertTrue(glob.matches(value));
}

代码示例来源:origin: hcoles/pitest

private Predicate<ClassPathRoot> createCodePathFilter() {
 if ((this.codePaths != null) && !this.codePaths.isEmpty()) {
  return new PathNamePredicate(Prelude.or(Glob
    .toGlobPredicates(this.codePaths)));
 } else {
  return new DefaultCodePathPredicate();
 }
}

相关文章