use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldAutocompleteToB.
@Test
public void shouldAutocompleteToB() throws Exception {
String code = "import java.awt.Color;\n" + "System.out.println( Color.B";
// 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 autocompleteMapAfterDot.
@Test
public void autocompleteMapAfterDot() throws Exception {
String code = "Map 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 SQLAutocompleteTest method shouldAutocompleteToValues.
@Test
public void shouldAutocompleteToValues() throws Exception {
// given
givenColorTable();
// when
String code = "INSERT INTO color (id, name, code) VALU";
AutocompleteResult autocomplete = sqlEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(35);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class SQLAutocompleteTest method shouldAutocompleteTo_s.
@Test
public void shouldAutocompleteTo_s() throws Exception {
// when
AutocompleteResult autocomplete = sqlEvaluator.autocomplete("s", 1);
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class ScalaAutocompleteTest method autocomplete_autocompleteResultNotEmpty.
@Test
public void autocomplete_autocompleteResultNotEmpty() throws Exception {
// when
AutocompleteResult autocomplete = scalaEvaluator.autocomplete("val numbers = Li", 16);
// then
Assertions.assertThat(autocomplete.getMatches()).isNotEmpty();
Assertions.assertThat(autocomplete.getStartIndex()).isEqualTo(14);
}
Aggregations