Search in sources :

Example 61 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToParamArray.

@Ignore
@Test
public void shouldReturnResultEqualToParamArray() throws Exception {
    String code = "int[] paramArray = new int[]{1, 3, 5};\n" + "System.out.println(paramA";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramArray");
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 62 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteTest method shouldReturnImplements.

@Test
public void shouldReturnImplements() throws Exception {
    String code = "class Coordinates implemen";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches().get(0)).isEqualTo("implements");
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 8);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Example 63 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToParamMap.

@Ignore
@Test
public void shouldReturnResultEqualToParamMap() throws Exception {
    String code = "Map<String,Integer> paramMap = new HashMap<>();\n" + "System.out.println( par";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramMap");
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 64 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteTest method shouldReturnResultEqualToParamInt.

@Ignore
@Test
public void shouldReturnResultEqualToParamInt() throws Exception {
    String code = "int paramInt = 10;\n" + "System.out.println( par";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramInt");
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 65 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteTest method autocompleteToJavaPackage.

@Test
public void autocompleteToJavaPackage() throws Exception {
    String code = "jav";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches()).isNotEmpty();
    assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Aggregations

AutocompleteResult (com.twosigma.beakerx.autocomplete.AutocompleteResult)107 Test (org.junit.Test)102 Ignore (org.junit.Ignore)20 BaseEvaluator (com.twosigma.beakerx.evaluator.BaseEvaluator)10 Collectors (java.util.stream.Collectors)10 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)10 AfterClass (org.junit.AfterClass)10 BeforeClass (org.junit.BeforeClass)10 EvaluatorTest (com.twosigma.beakerx.evaluator.EvaluatorTest)6 KERNEL_PARAMETERS (com.twosigma.beakerx.evaluator.EvaluatorTest.KERNEL_PARAMETERS)6 EvaluatorTest.getTestTempFolderFactory (com.twosigma.beakerx.evaluator.EvaluatorTest.getTestTempFolderFactory)6 TestBeakerCellExecutor.cellExecutor (com.twosigma.beakerx.evaluator.TestBeakerCellExecutor.cellExecutor)6 JavaEvaluator (com.twosigma.beakerx.javash.evaluator.JavaEvaluator)6 KernelTest (com.twosigma.beakerx.KernelTest)4 AutocompleteCandidate (com.twosigma.beakerx.autocomplete.AutocompleteCandidate)4 TestGroovyEvaluator (com.twosigma.beakerx.groovy.TestGroovyEvaluator)4 ArrayList (java.util.ArrayList)4 ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)2 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)2 Lexer (org.antlr.v4.runtime.Lexer)2