use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteArrayListWithGenericsAfterDot.
@Test
public void autocompleteArrayListWithGenericsAfterDot() throws Exception {
String code = "List<String> 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.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 JavaEvaluatorAutocompleteTest method autocompleteToMethodsForImportedClassesSeparatedBySemicolon.
@Ignore
@Test
public void autocompleteToMethodsForImportedClassesSeparatedBySemicolon() throws Exception {
String code = "import com.twosigma.beakerx.mimetype.MIMEContainer;" + "import groovy.json.JsonSlurper\n" + "def jsonSlurper = new JsonSlurper()\n" + "def json = jsonSlurper.";
// 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 shouldReturnResultEqualToBLUE.
@Ignore
@Test
public void shouldReturnResultEqualToBLUE() throws Exception {
String code = "import static java.awt.Color.BLUE\n" + "System.out.println( BL";
// when
AutocompleteResult autocomplete = evaluator().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 JavaEvaluatorAutocompleteTest method autocompleteToFileMethods.
@Test
public void autocompleteToFileMethods() throws Exception {
String code = "fname = \"demoResources/bar-chart.vg.json\"\n" + "fileContents = new File(fname)\n" + "fileContents.t";
// 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 autocompleteToList.
@Test
public void autocompleteToList() throws Exception {
String code = "Li";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
Aggregations