use of com.yahoo.vespa.indexinglanguage.SimpleTestAdapter in project vespa by vespa-engine.
the class SubstringTestCase method requireThatStringIsSliced.
@Test
public void requireThatStringIsSliced() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("666999"));
new SubstringExpression(2, 4).execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof StringFieldValue);
assertEquals("69", ((StringFieldValue) val).getString());
}
use of com.yahoo.vespa.indexinglanguage.SimpleTestAdapter in project vespa by vespa-engine.
the class InputTestCase method requireThatExpressionCanBeVerified.
@Test
public void requireThatExpressionCanBeVerified() {
SimpleTestAdapter adapter = new SimpleTestAdapter(new Field("foo", DataType.STRING));
adapter.setOutputValue(null, "foo", new StringFieldValue("69"));
assertEquals(DataType.STRING, new InputExpression("foo").verify(adapter));
try {
new InputExpression("bar").verify(adapter);
fail();
} catch (VerificationException e) {
assertEquals("Field 'bar' not found.", e.getMessage());
}
}
use of com.yahoo.vespa.indexinglanguage.SimpleTestAdapter in project vespa by vespa-engine.
the class InputTestCase method requireThatFieldIsRead.
@Test
public void requireThatFieldIsRead() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter(new Field("in", DataType.STRING)));
ctx.setOutputValue(null, "in", new StringFieldValue("69"));
new InputExpression("in").execute(ctx);
assertEquals(new StringFieldValue("69"), ctx.getValue());
}
use of com.yahoo.vespa.indexinglanguage.SimpleTestAdapter in project vespa by vespa-engine.
the class TokenizeTestCase method requireThatValueIsAnnotated.
@Test
public void requireThatValueIsAnnotated() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("foo"));
new TokenizeExpression(new SimpleLinguistics(), new AnnotatorConfig()).execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof StringFieldValue);
assertNotNull(((StringFieldValue) val).getSpanTree(SpanTrees.LINGUISTICS));
}
use of com.yahoo.vespa.indexinglanguage.SimpleTestAdapter in project vespa by vespa-engine.
the class ParenthesisTestCase method requireThatNestedExpressionIsRun.
@Test
public void requireThatNestedExpressionIsRun() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter(new Field("in", DataType.STRING)));
ctx.setOutputValue(null, "in", new StringFieldValue("69"));
new ParenthesisExpression(new InputExpression("in")).execute(ctx);
assertTrue(ctx.getValue() instanceof StringFieldValue);
assertEquals("69", ((StringFieldValue) ctx.getValue()).getString());
}
Aggregations