Search in sources :

Example 1 with IntegerFieldKey

use of io.datarouter.model.field.imp.comparable.IntegerFieldKey in project datarouter by hotpads.

the class FieldSetToolTests method testGetConcatenatedValueBytes.

@Test
public void testGetConcatenatedValueBytes() {
    List<Field<?>> fields = List.of(new IntegerField(new IntegerFieldKey("a"), 55), new StringField(new StringFieldKey("b"), "abc"), new StringField(new StringFieldKey("c"), "xyz"));
    int lengthWithout = 4 + 3 + 1 + 3;
    int lengthWith = lengthWithout + 1;
    Bytes withoutTrailingByte = new Bytes(FieldTool.getConcatenatedValueBytesUnterminated(fields));
    Bytes withTrailingByte = new Bytes(FieldTool.getConcatenatedValueBytes(fields));
    Assert.assertEquals(withoutTrailingByte.getLength(), lengthWithout);
    Assert.assertEquals(withTrailingByte.getLength(), lengthWith);
}
Also used : IntegerField(io.datarouter.model.field.imp.comparable.IntegerField) StringField(io.datarouter.model.field.imp.StringField) Bytes(io.datarouter.bytes.Bytes) StringFieldKey(io.datarouter.model.field.imp.StringFieldKey) IntegerFieldKey(io.datarouter.model.field.imp.comparable.IntegerFieldKey) StringField(io.datarouter.model.field.imp.StringField) IntegerField(io.datarouter.model.field.imp.comparable.IntegerField) Test(org.testng.annotations.Test)

Aggregations

Bytes (io.datarouter.bytes.Bytes)1 StringField (io.datarouter.model.field.imp.StringField)1 StringFieldKey (io.datarouter.model.field.imp.StringFieldKey)1 IntegerField (io.datarouter.model.field.imp.comparable.IntegerField)1 IntegerFieldKey (io.datarouter.model.field.imp.comparable.IntegerFieldKey)1 Test (org.testng.annotations.Test)1