@Test public void resolve_invalid_token() { exceptionRule.expect(NoSuchElementException.class); exceptionRule.expectMessage("Token not found: 2:0:2:3"); otherToken(1, 0, "foo"); RangeConverter.resolveToken(metaDataProvider, "2:0:2:3"); }
@Nullable public static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference) { TextRange range = parse(tokenReference); if (range == null) { return null; } return metaDataProvider.firstToken(range) .orElseThrow(() -> new NoSuchElementException("Token not found: " + tokenReference)); }
RangeConverter { @Nullable public static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference) { TextRange range = parse(tokenReference); if (range == null) { return null; } return metaDataProvider.firstToken(range) .orElseThrow(() -> new NoSuchElementException("Token not found: " + tokenReference)); } }
RangeConverter { @Nullable public static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference) { TextRange range = parse(tokenReference); if (range == null) { return null; } return metaDataProvider.firstToken(range) .orElseThrow(() -> new NoSuchElementException("Token not found: " + tokenReference)); } private  RangeConverter(); }
RangeConverter { @Nullable public static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference) { TextRange range = parse(tokenReference); if (range == null) { return null; } return metaDataProvider.firstToken(range) .orElseThrow(() -> new NoSuchElementException("Token not found: " + tokenReference)); } private  RangeConverter(); @Nullable static String format(@Nullable TextRange range); @Nullable static TextRange parse(@Nullable String value); @Nullable static String tokenReference(@Nullable Token token); @Nullable static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference); static String metaDataReference(Tree tree); static TreeMetaData resolveMetaData(TreeMetaDataProvider metaDataProvider, String metaDataReference); @Nullable static String treeReference(@Nullable Tree tree); @Nullable static T resolveNullableTree(Tree parent, @Nullable String treeReference, Class<T> childClass); }
RangeConverter { @Nullable public static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference) { TextRange range = parse(tokenReference); if (range == null) { return null; } return metaDataProvider.firstToken(range) .orElseThrow(() -> new NoSuchElementException("Token not found: " + tokenReference)); } private  RangeConverter(); @Nullable static String format(@Nullable TextRange range); @Nullable static TextRange parse(@Nullable String value); @Nullable static String tokenReference(@Nullable Token token); @Nullable static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference); static String metaDataReference(Tree tree); static TreeMetaData resolveMetaData(TreeMetaDataProvider metaDataProvider, String metaDataReference); @Nullable static String treeReference(@Nullable Tree tree); @Nullable static T resolveNullableTree(Tree parent, @Nullable String treeReference, Class<T> childClass);  }