use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteForJavaPackage.
@Test
public void autocompleteForJavaPackage() throws Exception {
String code = "java.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteForJavaAwtAfterDotPackage.
@Test
public void autocompleteForJavaAwtAfterDotPackage() throws Exception {
String code = "java.awt.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldReturnEmptyResultForIncorrectCode.
@Test
public void shouldReturnEmptyResultForIncorrectCode() throws Exception {
String code = "]";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldAutocompleteToSystem.
@Test
public void shouldAutocompleteToSystem() throws Exception {
String code = "Syste";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().size()).isGreaterThan(0);
assertThat(autocomplete.getMatches().stream().filter(x -> x.contains("System")).collect(Collectors.toList())).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteForClass_shouldReturnResultEqualToCoordinates.
@Ignore
@Test
public void autocompleteForClass_shouldReturnResultEqualToCoordinates() throws Exception {
String code = "class Coordinates {\n" + "double latitude\n" + "double longitude }\n" + "def coordinates = new Coordinates(latitude: 43.23, longitude: 3.67)\n" + "this.class.co";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("coordinates");
}
Aggregations