use of com.yahoo.document.datatypes.StringFieldValue in project vespa by vespa-engine.
the class HexDecodeTestCase method requireInputIsDecoded.
@Test
public void requireInputIsDecoded() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setValue(new StringFieldValue("1d28c2cd"));
new HexDecodeExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof LongFieldValue);
assertEquals(489210573L, ((LongFieldValue) val).getLong());
}
use of com.yahoo.document.datatypes.StringFieldValue in project vespa by vespa-engine.
the class HexDecodeTestCase method requireThatIllegalInputThrows.
@Test
public void requireThatIllegalInputThrows() {
try {
new HexDecodeExpression().execute(new StringFieldValue("???"));
fail();
} catch (IllegalArgumentException e) {
assertEquals("Illegal hex value '???'.", e.getMessage());
}
}
use of com.yahoo.document.datatypes.StringFieldValue in project vespa by vespa-engine.
the class HostNameTestCase method requireThatHostnameIsSet.
@Test
public void requireThatHostnameIsSet() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
new HostNameExpression().execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof StringFieldValue);
assertEquals(HostNameExpression.normalizeHostName(getDefaults().vespaHostname()), ((StringFieldValue) val).getString());
}
use of com.yahoo.document.datatypes.StringFieldValue in project vespa by vespa-engine.
the class JoinTestCase method requireThatValueIsJoined.
@Test
public void requireThatValueIsJoined() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
Array<StringFieldValue> arr = new Array<>(DataType.getArray(DataType.STRING));
arr.add(new StringFieldValue("6"));
arr.add(new StringFieldValue("9"));
ctx.setValue(arr);
new JoinExpression(";").execute(ctx);
assertEquals(new StringFieldValue("6;9"), ctx.getValue());
}
use of com.yahoo.document.datatypes.StringFieldValue in project vespa by vespa-engine.
the class NormalizeTestCase method requireThatInputIsNormalized.
@Test
public void requireThatInputIsNormalized() {
ExecutionContext ctx = new ExecutionContext(new SimpleTestAdapter());
ctx.setLanguage(Language.ENGLISH);
ctx.setValue(new StringFieldValue("b\u00e9yonc\u00e8"));
new NormalizeExpression(new SimpleLinguistics()).execute(ctx);
FieldValue val = ctx.getValue();
assertTrue(val instanceof StringFieldValue);
assertEquals("beyonce", ((StringFieldValue) val).getString());
}
Aggregations