use of org.apache.servicecomb.common.javassist.MultiWrapper in project incubator-servicecomb-java-chassis by apache.
the class TestArgsWrapSchema method testWriteObject.
@Test
public void testWriteObject() {
boolean status = true;
LinkedBuffer linkedBuffer = LinkedBuffer.allocate();
ProtobufOutput output = new ProtobufOutput(linkedBuffer);
String[] stringArray = new String[1];
stringArray[0] = "abc";
MultiWrapper multiWrapper = Mockito.mock(MultiWrapper.class);
Mockito.when(schema.newMessage()).thenReturn(multiWrapper);
try {
argsWrapSchema.writeObject(output, stringArray);
} catch (IOException e) {
status = true;
}
Assert.assertTrue(status);
}
use of org.apache.servicecomb.common.javassist.MultiWrapper in project incubator-servicecomb-java-chassis by apache.
the class TestArgsWrapSchema method testReadFromEmpty.
@Test
public void testReadFromEmpty() {
MultiWrapper multiWrapper = Mockito.mock(MultiWrapper.class);
Mockito.when(schema.newMessage()).thenReturn(multiWrapper);
Assert.assertNotNull(argsWrapSchema);
Object object = argsWrapSchema.readFromEmpty();
Assert.assertNull(object);
}
use of org.apache.servicecomb.common.javassist.MultiWrapper in project incubator-servicecomb-java-chassis by apache.
the class TestArgsWrapSchema method testReadObject.
@Test
public void testReadObject() {
boolean status = true;
Input input = null;
String[] stringArray = new String[1];
stringArray[0] = "abc";
MultiWrapper multiWrapper = Mockito.mock(MultiWrapper.class);
Mockito.when(schema.newMessage()).thenReturn(multiWrapper);
try {
Object object = argsWrapSchema.readObject(input);
Assert.assertNull(object);
} catch (IOException e) {
status = true;
}
Assert.assertTrue(status);
}
use of org.apache.servicecomb.common.javassist.MultiWrapper in project incubator-servicecomb-java-chassis by apache.
the class ArgsWrapSchema method writeObject.
public void writeObject(Output output, Object value) throws IOException {
MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
wrapper.writeFields((Object[]) value);
schema.writeTo(output, wrapper);
}
use of org.apache.servicecomb.common.javassist.MultiWrapper in project incubator-servicecomb-java-chassis by apache.
the class ArgsWrapSchema method readObject.
public Object readObject(Input input) throws IOException {
MultiWrapper wrapper = (MultiWrapper) schema.newMessage();
schema.mergeFrom(input, wrapper);
return wrapper.readFields();
}
Aggregations