use of org.camunda.bpm.engine.impl.variable.serializer.ValueFields in project camunda-bpm-platform by camunda.
the class FileValueSerializerTest method testWriteMimetypeFilenameAndBytesValue.
@Test
public void testWriteMimetypeFilenameAndBytesValue() throws UnsupportedEncodingException {
String filename = "test.txt";
String mimeType = "text/json";
InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/camunda/bpm/engine/test/standalone/variables/simpleFile.txt");
FileValue fileValue = Variables.fileValue(filename).mimeType(mimeType).file(is).create();
ValueFields valueFields = new MockValueFields();
serializer.writeValue(fileValue, valueFields);
assertThat(new String(valueFields.getByteArrayValue(), "UTF-8"), is("text"));
assertThat(valueFields.getTextValue(), is(filename));
assertThat(valueFields.getTextValue2(), is(mimeType + SEPARATOR));
}
Aggregations