◆ encodeErrorEnvelopeWithNullDetailsTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithNullDetailsTest |
( |
| ) |
|
|
inline |
Definition at line 58 of file StandardMethodCodecTest.java.
58 {
60 StandardMethodCodec.INSTANCE.encodeErrorEnvelope("code", "error", null);
63 try {
64 StandardMethodCodec.INSTANCE.decodeEnvelope(
buffer);
65 fail(
"Should have thrown a FlutterException since this is an error envelope.");
66 }
catch (FlutterException
result) {
67 assertEquals(
"code",
result.code);
68 assertEquals(
"error",
result.getMessage());
69 assertNull(
result.details);
70 }
71 }
static void fail(const SkString &err)
static const uint8_t buffer[]
◆ encodeErrorEnvelopeWithStacktraceTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithStacktraceTest |
( |
| ) |
|
|
inline |
Definition at line 95 of file StandardMethodCodecTest.java.
95 {
96 final Exception
e =
new IllegalArgumentException(
"foo");
98 StandardMethodCodec.INSTANCE.encodeErrorEnvelopeWithStacktrace(
99 "code",
e.getMessage(), e,
"error stacktrace");
102 buffer.order(ByteOrder.nativeOrder());
104 final Object
code = StandardMessageCodec.INSTANCE.readValue(
buffer);
105 final Object
message = StandardMessageCodec.INSTANCE.readValue(
buffer);
106 final Object details = StandardMessageCodec.INSTANCE.readValue(
buffer);
107 final Object stacktrace = StandardMessageCodec.INSTANCE.readValue(
buffer);
108 assertEquals("code", (String) code);
109 assertEquals(
"foo", (String)
message);
110 String stack = (String) details;
111 assertTrue(
112 stack.contains(
113 "at io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithStacktraceTest(StandardMethodCodecTest.java:"));
114 assertEquals("error stacktrace", (String) stacktrace);
115 }
FlutterSemanticsFlag flag
◆ encodeErrorEnvelopeWithThrowableTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithThrowableTest |
( |
| ) |
|
|
inline |
Definition at line 74 of file StandardMethodCodecTest.java.
74 {
75 final Exception
e =
new IllegalArgumentException(
"foo");
77 StandardMethodCodec.INSTANCE.encodeErrorEnvelope(
"code",
e.getMessage(), e);
80 try {
81 StandardMethodCodec.INSTANCE.decodeEnvelope(
buffer);
82 fail(
"Should have thrown a FlutterException since this is an error envelope.");
83 }
catch (FlutterException
result) {
84 assertEquals(
"code",
result.code);
85 assertEquals(
"foo",
result.getMessage());
86
87 String stack = (String)
result.details;
88 assertTrue(
89 stack.contains(
90 "at io.flutter.plugin.common.StandardMethodCodecTest.encodeErrorEnvelopeWithThrowableTest(StandardMethodCodecTest.java:"));
91 }
92 }
◆ encodeMethodTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeMethodTest |
( |
| ) |
|
|
inline |
Definition at line 23 of file StandardMethodCodecTest.java.
23 {
24 final Map<String, String>
args =
new HashMap<>();
25 args.put(
"testArg",
"testValue");
27 final ByteBuffer
buffer = StandardMethodCodec.INSTANCE.encodeMethodCall(call);
32 assertEquals(
call.arguments,
result.arguments);
33 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
◆ encodeSuccessEnvelopeTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeSuccessEnvelopeTest |
( |
| ) |
|
|
inline |
Definition at line 36 of file StandardMethodCodecTest.java.
36 {
37 final Map<String, Integer> success = new HashMap<>();
38 success.put("result", 1);
39 final ByteBuffer
buffer = StandardMethodCodec.INSTANCE.encodeSuccessEnvelope(success);
42 final Object
result = StandardMethodCodec.INSTANCE.decodeEnvelope(
buffer);
43 assertEquals(success,
result);
44 }
◆ encodeSuccessEnvelopeUnsupportedObjectTest()
void io.flutter.plugin.common.StandardMethodCodecTest.encodeSuccessEnvelopeUnsupportedObjectTest |
( |
| ) |
|
|
inline |
Definition at line 47 of file StandardMethodCodecTest.java.
47 {
48 final StandardMethodCodecTest joke = new StandardMethodCodecTest();
49 try {
50 final ByteBuffer
buffer = StandardMethodCodec.INSTANCE.encodeSuccessEnvelope(joke);
51 fail(
"Should have failed to convert unsupported type.");
52 } catch (IllegalArgumentException e) {
53
54 }
55 }
The documentation for this class was generated from the following file: