use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToParamInt.
@Test
public void shouldReturnResultEqualToParamInt() throws Exception {
String code = "int paramInt = 10\n" + "println par";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramInt");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToBLUE.
@Test
public void shouldReturnResultEqualToBLUE() throws Exception {
String code = "import static java.awt.Color.BLUE\n" + "println BL";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("BLUE");
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 2);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteToArrayList.
@Test
public void autocompleteToArrayList() throws Exception {
String code = "ArrayLi";
// when
AutocompleteResult autocomplete = groovyEvaluator.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 GroovyEvaluatorAutocompleteTest method autocompleteForJavaAwtPackage.
@Test
public void autocompleteForJavaAwtPackage() throws Exception {
String code = "java.aw";
// when
AutocompleteResult autocomplete = groovyEvaluator.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 GroovyEvaluatorAutocompleteTest method autocompleteMapWithGenericsAfterDot.
@Test
public void autocompleteMapWithGenericsAfterDot() throws Exception {
String code = "Map<String,String> myMap = new HashMap<>();\n" + "myMap.";
// when
AutocompleteResult autocomplete = groovyEvaluator.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());
}
Aggregations