use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToImport.
@Test
public void shouldReturnResultEqualToImport() throws Exception {
String code = "imp";
// when
AutocompleteResult autocomplete = groovyEvaluator.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 GroovyEvaluatorAutocompleteTest method autocompleteShouldNotMatchForEmptyString.
@Test
public void autocompleteShouldNotMatchForEmptyString() throws Exception {
String code = "";
// when
AutocompleteResult autocomplete = groovyEvaluator.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 GroovyEvaluatorAutocompleteTest method autocompleteArrayListAfterDot.
@Test
public void autocompleteArrayListAfterDot() throws Exception {
String code = "List myList = new ArrayList();\n" + "myList.";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getMatches().stream().filter(x -> x.contains("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 GroovyEvaluatorAutocompleteTest method autocompleteForJavaAwtAfterDotPackage.
@Test
public void autocompleteForJavaAwtAfterDotPackage() throws Exception {
String code = "java.awt.";
// when
AutocompleteResult autocomplete = groovyEvaluator.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 GroovyEvaluatorAutocompleteTest method autocompleteArrayListWithGenericsAfterDot.
@Test
public void autocompleteArrayListWithGenericsAfterDot() throws Exception {
String code = "List<String> myList = new ArrayList();\n" + "myList.";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getMatches().stream().filter(x -> x.contains("add")).collect(Collectors.toList())).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
Aggregations