use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method defaultImportsAutocompleteToRED.
@Test
public void defaultImportsAutocompleteToRED() throws Exception {
String code = "def colors = [ Color.RE";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 2);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteMapWithGenericsAfterDot.
@Test
public void autocompleteMapWithGenericsAfterDot() throws Exception {
String code = "Map<String,String> myMap = new HashMap<>();\n" + "myMap.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getMatches().stream().filter(x -> x.contains("put")).collect(Collectors.toList())).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToImport.
@Test
public void shouldReturnResultEqualToImport() throws Exception {
String code = "imp";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("import");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldReturnAutocompleteForPrintlnWithComment.
@Ignore
@Test
public void shouldReturnAutocompleteForPrintlnWithComment() throws Exception {
// when
AutocompleteResult autocomplete = evaluator().autocomplete("//comment\n" + "System.out.printl\n" + "System.out.printl", 27);
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(21);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteMatchesForSystemAfterDot.
@Test
public void autocompleteMatchesForSystemAfterDot() throws Exception {
String code = "System.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
}
Aggregations