use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteArrayListAfterDot.
@Test
public void autocompleteArrayListAfterDot() throws Exception {
String code = "List myList = new ArrayList();\n" + "myList.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getMatches().stream().filter(x -> x.equals("add")).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 autocompleteToArrayList.
@Test
public void autocompleteToArrayList() throws Exception {
String code = "ArrayLi";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteMatchesToColor.
@Test
public void autocompleteMatchesToColor() throws Exception {
String code = "Colo";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteMatchesToRED.
@Test
public void autocompleteMatchesToRED() throws Exception {
String code = "Color.R";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 1);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToToString.
@Ignore
@Test
public void shouldReturnResultEqualToToString() throws Exception {
String code = "String v = \"str\";\nv.toS";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("toString");
}
Aggregations