use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToParamString.
@Ignore
@Test
public void shouldReturnResultEqualToParamString() throws Exception {
String code = "String paramString = \"str\";\n" + "System.out.println( \"test ${par";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramString");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteWithMagicCommands.
@Test
public void autocompleteWithMagicCommands() throws Exception {
String code = "%classpath add jar demoResources/BeakerXClasspathTest.jar\n" + "System.";
// 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 autocompleteMatchesForSystemOutAfterDot.
@Test
public void autocompleteMatchesForSystemOutAfterDot() throws Exception {
String code = "System.out.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getMatches()).contains("println");
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteToMethodsForImportedClassesSeparatedByNewLine.
@Ignore
@Test
public void autocompleteToMethodsForImportedClassesSeparatedByNewLine() throws Exception {
String code = "import com.twosigma.beakerx.mimetype.MIMEContainer\n" + "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 shouldReturnExtends.
@Test
public void shouldReturnExtends() throws Exception {
String code = "class Coordinates exten";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualTo("extends");
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 5);
}
Aggregations