@Test void testTokenRetrieving() { MyDocumentModel model = new MyDocumentModel("a bc\r\nde", AnalysisResult.empty()); assertEquals("", model.getTokenBeforePosition(new Position(0, 0))); assertEquals("a", model.getTokenBeforePosition(new Position(0, 1))); assertEquals("bc", model.getTokenBeforePosition(new Position(0, 4))); assertEquals("d", model.getTokenBeforePosition(new Position(1, 1))); assertEquals("de", model.getTokenBeforePosition(new Position(1, 2))); }
public String getTokenBeforePosition(Position position) { Line route = getLine(position.getLine()); if (route == null) { return ""; } return retrieveTokenBeginning(position, route); }
MyDocumentModel { public String getTokenBeforePosition(Position position) { Line route = getLine(position.getLine()); if (route == null) { return ""; } return retrieveTokenBeginning(position, route); } }
MyDocumentModel { public String getTokenBeforePosition(Position position) { Line route = getLine(position.getLine()); if (route == null) { return ""; } return retrieveTokenBeginning(position, route); } MyDocumentModel(String text, AnalysisResult analysisResult);  MyDocumentModel(String text); }
MyDocumentModel { public String getTokenBeforePosition(Position position) { Line route = getLine(position.getLine()); if (route == null) { return ""; } return retrieveTokenBeginning(position, route); } MyDocumentModel(String text, AnalysisResult analysisResult);  MyDocumentModel(String text); Line getLine(int number); String getTokenBeforePosition(Position position); String getFullTokenAtPosition(Position position); }
MyDocumentModel { public String getTokenBeforePosition(Position position) { Line route = getLine(position.getLine()); if (route == null) { return ""; } return retrieveTokenBeginning(position, route); } MyDocumentModel(String text, AnalysisResult analysisResult);  MyDocumentModel(String text); Line getLine(int number); String getTokenBeforePosition(Position position); String getFullTokenAtPosition(Position position);  }