@Test public void testMatchState() { assertExpectedMatch(FindAddress.matchState("CALIFORNIA", 0), "CALIFORNIA"); assertExpectedMatch(FindAddress.matchState("ca", 0), "ca"); assertExpectedMatch(FindAddress.matchState(" CALIFORNIA", 1), "CALIFORNIA"); assertExpectedMatch(FindAddress.matchState(" ca", 1), "ca"); Assert.assertNull(FindAddress.matchState("notcalifornia", 3)); Assert.assertNull(FindAddress.matchState("californi", 0)); Assert.assertNull(FindAddress.matchState("northern mariana", 0)); Assert.assertNull(FindAddress.matchState("northern mariana island", 0)); Assert.assertNull(FindAddress.matchState("zz", 0)); }
@VisibleForTesting public static MatchResult matchState(String content, int offset) { if (offset > 0 && WORD_DELIM.indexOf(content.charAt(offset - 1)) == -1) return null; Matcher stateMatcher = sStateRe.matcher(content).region(offset, content.length()); return stateMatcher.lookingAt() ? stateMatcher.toMatchResult() : null; }
FindAddress { @VisibleForTesting public static MatchResult matchState(String content, int offset) { if (offset > 0 && WORD_DELIM.indexOf(content.charAt(offset - 1)) == -1) return null; Matcher stateMatcher = sStateRe.matcher(content).region(offset, content.length()); return stateMatcher.lookingAt() ? stateMatcher.toMatchResult() : null; } }
FindAddress { @VisibleForTesting public static MatchResult matchState(String content, int offset) { if (offset > 0 && WORD_DELIM.indexOf(content.charAt(offset - 1)) == -1) return null; Matcher stateMatcher = sStateRe.matcher(content).region(offset, content.length()); return stateMatcher.lookingAt() ? stateMatcher.toMatchResult() : null; } private  FindAddress(); }
FindAddress { @VisibleForTesting public static MatchResult matchState(String content, int offset) { if (offset > 0 && WORD_DELIM.indexOf(content.charAt(offset - 1)) == -1) return null; Matcher stateMatcher = sStateRe.matcher(content).region(offset, content.length()); return stateMatcher.lookingAt() ? stateMatcher.toMatchResult() : null; } private  FindAddress(); @VisibleForTesting static MatchResult matchHouseNumber(String content, int offset); @VisibleForTesting static MatchResult matchState(String content, int offset); @VisibleForTesting static boolean isValidZipCode(String zipCode, String state); @VisibleForTesting static boolean isValidZipCode(String zipCode); @VisibleForTesting static boolean isValidLocationName(String location); }
FindAddress { @VisibleForTesting public static MatchResult matchState(String content, int offset) { if (offset > 0 && WORD_DELIM.indexOf(content.charAt(offset - 1)) == -1) return null; Matcher stateMatcher = sStateRe.matcher(content).region(offset, content.length()); return stateMatcher.lookingAt() ? stateMatcher.toMatchResult() : null; } private  FindAddress(); @VisibleForTesting static MatchResult matchHouseNumber(String content, int offset); @VisibleForTesting static MatchResult matchState(String content, int offset); @VisibleForTesting static boolean isValidZipCode(String zipCode, String state); @VisibleForTesting static boolean isValidZipCode(String zipCode); @VisibleForTesting static boolean isValidLocationName(String location);  }