31 package com.google.protobuf;
33 import proto2_test_check_utf8.TestCheckUtf8.BytesWrapper;
34 import proto2_test_check_utf8.TestCheckUtf8.StringWrapper;
35 import proto2_test_check_utf8_size.TestCheckUtf8Size.BytesWrapperSize;
36 import proto2_test_check_utf8_size.TestCheckUtf8Size.StringWrapperSize;
37 import java.io.ByteArrayInputStream;
38 import junit.framework.TestCase;
67 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
68 }
catch (IllegalArgumentException exception) {
69 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
76 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
77 }
catch (IllegalArgumentException exception) {
78 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
85 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
86 }
catch (IllegalArgumentException exception) {
87 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
100 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
101 }
catch (IllegalArgumentException exception) {
102 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
109 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
110 }
catch (IllegalArgumentException exception) {
111 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
118 fail(
"Expected IllegalArgumentException for non UTF-8 byte string.");
119 }
catch (IllegalArgumentException exception) {
120 assertEquals(
"Byte string is not UTF-8.", exception.getMessage());
133 defaultInstance.getParserForType().parseFrom(
data);
134 fail(
"Expected InvalidProtocolBufferException for non UTF-8 byte string.");
136 assertEquals(
"Protocol message had invalid UTF-8.", exception.getMessage());
139 defaultInstance.newBuilderForType().mergeFrom(
data);
140 fail(
"Expected InvalidProtocolBufferException for non UTF-8 byte string.");
142 assertEquals(
"Protocol message had invalid UTF-8.", exception.getMessage());
145 defaultInstance.getParserForType().parseFrom(
new ByteArrayInputStream(
data));
146 fail(
"Expected InvalidProtocolBufferException for non UTF-8 byte string.");
148 assertEquals(
"Protocol message had invalid UTF-8.", exception.getMessage());
151 defaultInstance.newBuilderForType().mergeFrom(
new ByteArrayInputStream(
data));
152 fail(
"Expected InvalidProtocolBufferException for non UTF-8 byte string.");
154 assertEquals(
"Protocol message had invalid UTF-8.", exception.getMessage());