public static LabelAtom findNearest(String name) { List<String> candidates = new ArrayList<String>(); for (LabelAtom a : Jenkins.getInstance().getLabelAtoms()) { candidates.add(a.getName()); } return get(EditDistance.findNearest(name, candidates)); }
public void testLaxParsing() { // this should parse as an atom LabelAtom l = (LabelAtom) jenkins.getLabel("lucene.zones.apache.org (Solaris 10)"); assertEquals(l.getName(), "lucene.zones.apache.org (Solaris 10)"); assertEquals(l.getExpression(), "\"lucene.zones.apache.org (Solaris 10)\""); }