• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 //     * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //     * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 //     * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 package com.google.protobuf.kotlin
32 
33 import com.google.common.truth.Truth.assertThat
34 import com.google.protobuf.TestAllTypesLiteKt
35 import com.google.protobuf.TestAllTypesLiteKt.nestedMessage
36 import com.google.protobuf.TestUtilLite
37 import com.google.protobuf.TestUtilLite.toBytes
38 import com.google.protobuf.UnittestImportLite.ImportEnumLite
39 import com.google.protobuf.UnittestImportLite.ImportMessageLite
40 import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite
41 import com.google.protobuf.UnittestLite
42 import com.google.protobuf.UnittestLite.ForeignEnumLite
43 import com.google.protobuf.UnittestLite.TestAllTypesLite
44 import com.google.protobuf.UnittestLite.TestAllTypesLite.NestedEnum
45 import com.google.protobuf.UnittestLite.TestEmptyMessageLite
46 import com.google.protobuf.UnittestLite.TestEmptyMessageWithExtensionsLite
47 import com.google.protobuf.copy
48 import com.google.protobuf.foreignMessageLite
49 import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2
50 import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2
51 import com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface
52 import com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt
53 import com.google.protobuf.kotlin.generator.evilNamesProto2
54 import com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2
55 import com.google.protobuf.kotlin.generator.interface_
56 import com.google.protobuf.optionalGroupExtensionLite
57 import com.google.protobuf.repeatedGroupExtensionLite
58 import com.google.protobuf.testAllExtensionsLite
59 import com.google.protobuf.testAllTypesLite
60 import com.google.protobuf.testEmptyMessageLite
61 import com.google.protobuf.testEmptyMessageWithExtensionsLite
62 import protobuf_unittest.MapLiteUnittest.MapEnumLite
63 import protobuf_unittest.MapLiteUnittest.TestMapLite
64 import protobuf_unittest.testMapLite
65 import org.junit.Test
66 import org.junit.runner.RunWith
67 import org.junit.runners.JUnit4
68 
69 @RunWith(JUnit4::class)
70 class Proto2LiteTest {
71   @Test
testSettersnull72   fun testSetters() {
73     assertThat(
74         testAllTypesLite {
75           optionalInt32 = 101
76           optionalInt64 = 102
77           optionalUint32 = 103
78           optionalUint64 = 104
79           optionalSint32 = 105
80           optionalSint64 = 106
81           optionalFixed32 = 107
82           optionalFixed64 = 108
83           optionalSfixed32 = 109
84           optionalSfixed64 = 110
85           optionalFloat = 111.0f
86           optionalDouble = 112.0
87           optionalBool = true
88           optionalString = "115"
89           optionalBytes = toBytes("116")
90           optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
91           optionalNestedMessage = nestedMessage { bb = 118 }
92           optionalForeignMessage = foreignMessageLite { c = 119 }
93           optionalImportMessage = ImportMessageLite.newBuilder().setD(120).build()
94           optionalPublicImportMessage = PublicImportMessageLite.newBuilder().setE(126).build()
95           optionalLazyMessage = nestedMessage { bb = 127 }
96           optionalUnverifiedLazyMessage = nestedMessage { bb = 128 }
97           optionalNestedEnum = NestedEnum.BAZ
98           optionalForeignEnum = ForeignEnumLite.FOREIGN_LITE_BAZ
99           optionalImportEnum = ImportEnumLite.IMPORT_LITE_BAZ
100           optionalStringPiece = "124"
101           optionalCord = "125"
102           repeatedInt32.add(201)
103           repeatedInt64.add(202)
104           repeatedUint32.add(203)
105           repeatedUint64.add(204)
106           repeatedSint32.add(205)
107           repeatedSint64.add(206)
108           repeatedFixed32.add(207)
109           repeatedFixed64.add(208)
110           repeatedSfixed32.add(209)
111           repeatedSfixed64.add(210)
112           repeatedFloat.add(211f)
113           repeatedDouble.add(212.0)
114           repeatedBool.add(true)
115           repeatedString.add("215")
116           repeatedBytes.add(toBytes("216"))
117           repeatedGroup.add(TestAllTypesLiteKt.repeatedGroup { a = 217 })
118           repeatedNestedMessage.add(nestedMessage { bb = 218 })
119           repeatedForeignMessage.add(foreignMessageLite { c = 219 })
120           repeatedImportMessage.add(ImportMessageLite.newBuilder().setD(220).build())
121           repeatedLazyMessage.add(nestedMessage { bb = 227 })
122           repeatedNestedEnum.add(NestedEnum.BAR)
123           repeatedForeignEnum.add(ForeignEnumLite.FOREIGN_LITE_BAR)
124           repeatedImportEnum.add(ImportEnumLite.IMPORT_LITE_BAR)
125           repeatedStringPiece.add("224")
126           repeatedCord.add("225")
127           repeatedInt32 += 301
128           repeatedInt64 += 302
129           repeatedUint32 += 303
130           repeatedUint64 += 304
131           repeatedSint32 += 305
132           repeatedSint64 += 306
133           repeatedFixed32 += 307
134           repeatedFixed64 += 308
135           repeatedSfixed32 += 309
136           repeatedSfixed64 += 310
137           repeatedFloat += 311f
138           repeatedDouble += 312.0
139           repeatedBool += false
140           repeatedString += "315"
141           repeatedBytes += toBytes("316")
142           repeatedGroup += TestAllTypesLiteKt.repeatedGroup { a = 317 }
143           repeatedNestedMessage += nestedMessage { bb = 318 }
144           repeatedForeignMessage += foreignMessageLite { c = 319 }
145           repeatedImportMessage += ImportMessageLite.newBuilder().setD(320).build()
146           repeatedLazyMessage += TestAllTypesLiteKt.nestedMessage { bb = 327 }
147           repeatedNestedEnum += NestedEnum.BAZ
148           repeatedForeignEnum += ForeignEnumLite.FOREIGN_LITE_BAZ
149           repeatedImportEnum += ImportEnumLite.IMPORT_LITE_BAZ
150           repeatedStringPiece += "324"
151           repeatedCord += "325"
152           defaultInt32 = 401
153           defaultInt64 = 402
154           defaultUint32 = 403
155           defaultUint64 = 404
156           defaultSint32 = 405
157           defaultSint64 = 406
158           defaultFixed32 = 407
159           defaultFixed64 = 408
160           defaultSfixed32 = 409
161           defaultSfixed64 = 410
162           defaultFloat = 411f
163           defaultDouble = 412.0
164           defaultBool = false
165           defaultString = "415"
166           defaultBytes = toBytes("416")
167           defaultNestedEnum = NestedEnum.FOO
168           defaultForeignEnum = ForeignEnumLite.FOREIGN_LITE_FOO
169           defaultImportEnum = ImportEnumLite.IMPORT_LITE_FOO
170           defaultStringPiece = "424"
171           defaultCord = "425"
172           oneofUint32 = 601
173           oneofNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 602 }
174           oneofString = "603"
175           oneofBytes = toBytes("604")
176         }
177       )
178       .isEqualTo(TestUtilLite.getAllLiteSetBuilder().build())
179   }
180 
181   @Test
testGettersnull182   fun testGetters() {
183     testAllTypesLite {
184       optionalInt32 = 101
185       assertThat(optionalInt32).isEqualTo(101)
186       optionalString = "115"
187       assertThat(optionalString).isEqualTo("115")
188       optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
189       assertThat(optionalGroup).isEqualTo(TestAllTypesLiteKt.optionalGroup { a = 117 })
190       optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
191       assertThat(optionalNestedMessage).isEqualTo(TestAllTypesLiteKt.nestedMessage { bb = 118 })
192       optionalNestedEnum = NestedEnum.BAZ
193       assertThat(optionalNestedEnum).isEqualTo(NestedEnum.BAZ)
194       defaultInt32 = 401
195       assertThat(defaultInt32).isEqualTo(401)
196       oneofUint32 = 601
197       assertThat(oneofUint32).isEqualTo(601)
198     }
199   }
200 
201   @Test
testDefaultGettersnull202   fun testDefaultGetters() {
203     testAllTypesLite {
204       assertThat(defaultInt32).isEqualTo(41)
205       assertThat(defaultString).isEqualTo("hello")
206       assertThat(defaultNestedEnum).isEqualTo(NestedEnum.BAR)
207       assertThat(defaultStringPiece).isEqualTo("abc")
208     }
209   }
210 
211   @Test
testRepeatedGettersAndSettersnull212   fun testRepeatedGettersAndSetters() {
213     testAllTypesLite {
214       repeatedInt32.addAll(listOf(1, 2))
215       assertThat(repeatedInt32).isEqualTo(listOf(1, 2))
216       repeatedInt32 += listOf(3, 4)
217       assertThat(repeatedInt32).isEqualTo(listOf(1, 2, 3, 4))
218       repeatedInt32[0] = 5
219       assertThat(repeatedInt32).isEqualTo(listOf(5, 2, 3, 4))
220 
221       repeatedString.addAll(listOf("1", "2"))
222       assertThat(repeatedString).isEqualTo(listOf("1", "2"))
223       repeatedString += listOf("3", "4")
224       assertThat(repeatedString).isEqualTo(listOf("1", "2", "3", "4"))
225       repeatedString[0] = "5"
226       assertThat(repeatedString).isEqualTo(listOf("5", "2", "3", "4"))
227 
228       repeatedGroup.addAll(
229         listOf(
230           TestAllTypesLiteKt.repeatedGroup { a = 1 },
231           TestAllTypesLiteKt.repeatedGroup { a = 2 }
232         )
233       )
234       assertThat(repeatedGroup)
235         .isEqualTo(
236           listOf(
237             TestAllTypesLiteKt.repeatedGroup { a = 1 },
238             TestAllTypesLiteKt.repeatedGroup { a = 2 }
239           )
240         )
241       repeatedGroup +=
242         listOf(
243           TestAllTypesLiteKt.repeatedGroup { a = 3 },
244           TestAllTypesLiteKt.repeatedGroup { a = 4 }
245         )
246       assertThat(repeatedGroup)
247         .isEqualTo(
248           listOf(
249             TestAllTypesLiteKt.repeatedGroup { a = 1 },
250             TestAllTypesLiteKt.repeatedGroup { a = 2 },
251             TestAllTypesLiteKt.repeatedGroup { a = 3 },
252             TestAllTypesLiteKt.repeatedGroup { a = 4 }
253           )
254         )
255       repeatedGroup[0] = TestAllTypesLiteKt.repeatedGroup { a = 5 }
256       assertThat(repeatedGroup)
257         .isEqualTo(
258           listOf(
259             TestAllTypesLiteKt.repeatedGroup { a = 5 },
260             TestAllTypesLiteKt.repeatedGroup { a = 2 },
261             TestAllTypesLiteKt.repeatedGroup { a = 3 },
262             TestAllTypesLiteKt.repeatedGroup { a = 4 }
263           )
264         )
265 
266       repeatedNestedMessage.addAll(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
267       assertThat(repeatedNestedMessage)
268         .isEqualTo(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
269       repeatedNestedMessage += listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
270       assertThat(repeatedNestedMessage)
271         .isEqualTo(
272           listOf(
273             nestedMessage { bb = 1 },
274             nestedMessage { bb = 2 },
275             nestedMessage { bb = 3 },
276             nestedMessage { bb = 4 }
277           )
278         )
279       repeatedNestedMessage[0] = nestedMessage { bb = 5 }
280       assertThat(repeatedNestedMessage)
281         .isEqualTo(
282           listOf(
283             nestedMessage { bb = 5 },
284             nestedMessage { bb = 2 },
285             nestedMessage { bb = 3 },
286             nestedMessage { bb = 4 }
287           )
288         )
289 
290       repeatedNestedEnum.addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
291       assertThat(repeatedNestedEnum).isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
292       repeatedNestedEnum += listOf(NestedEnum.BAZ, NestedEnum.FOO)
293       assertThat(repeatedNestedEnum)
294         .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
295       repeatedNestedEnum[0] = NestedEnum.BAR
296       assertThat(repeatedNestedEnum)
297         .isEqualTo(listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
298     }
299   }
300 
301   @Test
testHazzersnull302   fun testHazzers() {
303     testAllTypesLite {
304       optionalInt32 = 101
305       assertThat(hasOptionalInt32()).isTrue()
306       assertThat(hasOptionalString()).isFalse()
307       optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
308       assertThat(hasOptionalGroup()).isTrue()
309       assertThat(hasOptionalNestedMessage()).isFalse()
310       optionalNestedEnum = NestedEnum.BAZ
311       assertThat(hasOptionalNestedEnum()).isTrue()
312       assertThat(hasDefaultInt32()).isFalse()
313       oneofUint32 = 601
314       assertThat(hasOneofUint32()).isTrue()
315     }
316 
317     testAllTypesLite {
318       assertThat(hasOptionalInt32()).isFalse()
319       optionalString = "115"
320       assertThat(hasOptionalString()).isTrue()
321       assertThat(hasOptionalGroup()).isFalse()
322       optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
323       assertThat(hasOptionalNestedMessage()).isTrue()
324       assertThat(hasOptionalNestedEnum()).isFalse()
325       defaultInt32 = 401
326       assertThat(hasDefaultInt32()).isTrue()
327       assertThat(hasOneofUint32()).isFalse()
328     }
329   }
330 
331   @Test
testClearsnull332   fun testClears() {
333     testAllTypesLite {
334       optionalInt32 = 101
335       clearOptionalInt32()
336       assertThat(hasOptionalInt32()).isFalse()
337 
338       optionalString = "115"
339       clearOptionalString()
340       assertThat(hasOptionalString()).isFalse()
341 
342       optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
343       clearOptionalGroup()
344       assertThat(hasOptionalGroup()).isFalse()
345 
346       optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
347       clearOptionalNestedMessage()
348       assertThat(hasOptionalNestedMessage()).isFalse()
349 
350       optionalNestedEnum = NestedEnum.BAZ
351       clearOptionalNestedEnum()
352       assertThat(hasOptionalNestedEnum()).isFalse()
353 
354       defaultInt32 = 401
355       clearDefaultInt32()
356       assertThat(hasDefaultInt32()).isFalse()
357 
358       oneofUint32 = 601
359       clearOneofUint32()
360       assertThat(hasOneofUint32()).isFalse()
361     }
362   }
363 
364   @Test
testCopynull365   fun testCopy() {
366     val message = testAllTypesLite {
367       optionalInt32 = 101
368       optionalString = "115"
369     }
370     val modifiedMessage = message.copy { optionalInt32 = 201 }
371 
372     assertThat(message)
373       .isEqualTo(
374         TestAllTypesLite.newBuilder().setOptionalInt32(101).setOptionalString("115").build()
375       )
376     assertThat(modifiedMessage)
377       .isEqualTo(
378         TestAllTypesLite.newBuilder().setOptionalInt32(201).setOptionalString("115").build()
379       )
380   }
381 
382   @Test
testOneofnull383   fun testOneof() {
384     val message = testAllTypesLite {
385       oneofString = "foo"
386       assertThat(oneofFieldCase).isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOF_STRING)
387       assertThat(oneofString).isEqualTo("foo")
388       clearOneofField()
389       assertThat(hasOneofUint32()).isFalse()
390       assertThat(oneofFieldCase).isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOFFIELD_NOT_SET)
391       oneofUint32 = 5
392     }
393 
394     assertThat(message.getOneofFieldCase()).isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOF_UINT32)
395     assertThat(message.getOneofUint32()).isEqualTo(5)
396   }
397 
398   @Test
testExtensionsSetnull399   fun testExtensionsSet() {
400     assertThat(
401         testAllExtensionsLite {
402           this[UnittestLite.optionalInt32ExtensionLite] = 101
403           this[UnittestLite.optionalInt64ExtensionLite] = 102L
404           this[UnittestLite.optionalUint32ExtensionLite] = 103
405           this[UnittestLite.optionalUint64ExtensionLite] = 104L
406           this[UnittestLite.optionalSint32ExtensionLite] = 105
407           this[UnittestLite.optionalSint64ExtensionLite] = 106L
408           this[UnittestLite.optionalFixed32ExtensionLite] = 107
409           this[UnittestLite.optionalFixed64ExtensionLite] = 108L
410           this[UnittestLite.optionalSfixed32ExtensionLite] = 109
411           this[UnittestLite.optionalSfixed64ExtensionLite] = 110L
412           this[UnittestLite.optionalFloatExtensionLite] = 111F
413           this[UnittestLite.optionalDoubleExtensionLite] = 112.0
414           this[UnittestLite.optionalBoolExtensionLite] = true
415           this[UnittestLite.optionalStringExtensionLite] = "115"
416           this[UnittestLite.optionalBytesExtensionLite] = toBytes("116")
417           this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
418           this[UnittestLite.optionalNestedMessageExtensionLite] =
419             TestAllTypesLiteKt.nestedMessage { bb = 118 }
420           this[UnittestLite.optionalForeignMessageExtensionLite] = foreignMessageLite { c = 119 }
421           this[UnittestLite.optionalImportMessageExtensionLite] =
422             ImportMessageLite.newBuilder().setD(120).build()
423           this[UnittestLite.optionalPublicImportMessageExtensionLite] =
424             PublicImportMessageLite.newBuilder().setE(126).build()
425           this[UnittestLite.optionalLazyMessageExtensionLite] =
426             TestAllTypesLiteKt.nestedMessage { bb = 127 }
427           this[UnittestLite.optionalUnverifiedLazyMessageExtensionLite] =
428             TestAllTypesLiteKt.nestedMessage { bb = 128 }
429           this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
430           this[UnittestLite.optionalForeignEnumExtensionLite] = ForeignEnumLite.FOREIGN_LITE_BAZ
431           this[UnittestLite.optionalImportEnumExtensionLite] = ImportEnumLite.IMPORT_LITE_BAZ
432           this[UnittestLite.optionalStringPieceExtensionLite] = "124"
433           this[UnittestLite.optionalCordExtensionLite] = "125"
434           this[UnittestLite.repeatedInt32ExtensionLite].add(201)
435           this[UnittestLite.repeatedInt64ExtensionLite].add(202L)
436           this[UnittestLite.repeatedUint32ExtensionLite].add(203)
437           this[UnittestLite.repeatedUint64ExtensionLite].add(204L)
438           this[UnittestLite.repeatedSint32ExtensionLite].add(205)
439           this[UnittestLite.repeatedSint64ExtensionLite].add(206L)
440           this[UnittestLite.repeatedFixed32ExtensionLite].add(207)
441           this[UnittestLite.repeatedFixed64ExtensionLite].add(208L)
442           this[UnittestLite.repeatedSfixed32ExtensionLite].add(209)
443           this[UnittestLite.repeatedSfixed64ExtensionLite].add(210L)
444           this[UnittestLite.repeatedFloatExtensionLite].add(211F)
445           this[UnittestLite.repeatedDoubleExtensionLite].add(212.0)
446           this[UnittestLite.repeatedBoolExtensionLite].add(true)
447           this[UnittestLite.repeatedStringExtensionLite].add("215")
448           this[UnittestLite.repeatedBytesExtensionLite].add(toBytes("216"))
449           this[UnittestLite.repeatedGroupExtensionLite].add(repeatedGroupExtensionLite { a = 217 })
450           this[UnittestLite.repeatedNestedMessageExtensionLite].add(
451             TestAllTypesLiteKt.nestedMessage { bb = 218 }
452           )
453           this[UnittestLite.repeatedForeignMessageExtensionLite].add(foreignMessageLite { c = 219 })
454           this[UnittestLite.repeatedImportMessageExtensionLite].add(
455             ImportMessageLite.newBuilder().setD(220).build()
456           )
457           this[UnittestLite.repeatedLazyMessageExtensionLite].add(
458             TestAllTypesLiteKt.nestedMessage { bb = 227 }
459           )
460           this[UnittestLite.repeatedNestedEnumExtensionLite].add(NestedEnum.BAR)
461           this[UnittestLite.repeatedForeignEnumExtensionLite].add(ForeignEnumLite.FOREIGN_LITE_BAR)
462           this[UnittestLite.repeatedImportEnumExtensionLite].add(ImportEnumLite.IMPORT_LITE_BAR)
463           this[UnittestLite.repeatedStringPieceExtensionLite].add("224")
464           this[UnittestLite.repeatedCordExtensionLite].add("225")
465           this[UnittestLite.repeatedInt32ExtensionLite] += 301
466           this[UnittestLite.repeatedInt64ExtensionLite] += 302L
467           this[UnittestLite.repeatedUint32ExtensionLite] += 303
468           this[UnittestLite.repeatedUint64ExtensionLite] += 304L
469           this[UnittestLite.repeatedSint32ExtensionLite] += 305
470           this[UnittestLite.repeatedSint64ExtensionLite] += 306L
471           this[UnittestLite.repeatedFixed32ExtensionLite] += 307
472           this[UnittestLite.repeatedFixed64ExtensionLite] += 308L
473           this[UnittestLite.repeatedSfixed32ExtensionLite] += 309
474           this[UnittestLite.repeatedSfixed64ExtensionLite] += 310L
475           this[UnittestLite.repeatedFloatExtensionLite] += 311F
476           this[UnittestLite.repeatedDoubleExtensionLite] += 312.0
477           this[UnittestLite.repeatedBoolExtensionLite] += false
478           this[UnittestLite.repeatedStringExtensionLite] += "315"
479           this[UnittestLite.repeatedBytesExtensionLite] += toBytes("316")
480           this[UnittestLite.repeatedGroupExtensionLite] += repeatedGroupExtensionLite { a = 317 }
481           this[UnittestLite.repeatedNestedMessageExtensionLite] +=
482             TestAllTypesLiteKt.nestedMessage { bb = 318 }
483           this[UnittestLite.repeatedForeignMessageExtensionLite] += foreignMessageLite { c = 319 }
484           this[UnittestLite.repeatedImportMessageExtensionLite] +=
485             ImportMessageLite.newBuilder().setD(320).build()
486           this[UnittestLite.repeatedLazyMessageExtensionLite] +=
487             TestAllTypesLiteKt.nestedMessage { bb = 327 }
488           this[UnittestLite.repeatedNestedEnumExtensionLite] += NestedEnum.BAZ
489           this[UnittestLite.repeatedForeignEnumExtensionLite] += ForeignEnumLite.FOREIGN_LITE_BAZ
490           this[UnittestLite.repeatedImportEnumExtensionLite] += ImportEnumLite.IMPORT_LITE_BAZ
491           this[UnittestLite.repeatedStringPieceExtensionLite] += "324"
492           this[UnittestLite.repeatedCordExtensionLite] += "325"
493           this[UnittestLite.defaultInt32ExtensionLite] = 401
494           this[UnittestLite.defaultInt64ExtensionLite] = 402L
495           this[UnittestLite.defaultUint32ExtensionLite] = 403
496           this[UnittestLite.defaultUint64ExtensionLite] = 404L
497           this[UnittestLite.defaultSint32ExtensionLite] = 405
498           this[UnittestLite.defaultSint64ExtensionLite] = 406L
499           this[UnittestLite.defaultFixed32ExtensionLite] = 407
500           this[UnittestLite.defaultFixed64ExtensionLite] = 408L
501           this[UnittestLite.defaultSfixed32ExtensionLite] = 409
502           this[UnittestLite.defaultSfixed64ExtensionLite] = 410L
503           this[UnittestLite.defaultFloatExtensionLite] = 411F
504           this[UnittestLite.defaultDoubleExtensionLite] = 412.0
505           this[UnittestLite.defaultBoolExtensionLite] = false
506           this[UnittestLite.defaultStringExtensionLite] = "415"
507           this[UnittestLite.defaultBytesExtensionLite] = toBytes("416")
508           this[UnittestLite.defaultNestedEnumExtensionLite] = NestedEnum.FOO
509           this[UnittestLite.defaultForeignEnumExtensionLite] = ForeignEnumLite.FOREIGN_LITE_FOO
510           this[UnittestLite.defaultImportEnumExtensionLite] = ImportEnumLite.IMPORT_LITE_FOO
511           this[UnittestLite.defaultStringPieceExtensionLite] = "424"
512           this[UnittestLite.defaultCordExtensionLite] = "425"
513           this[UnittestLite.oneofUint32ExtensionLite] = 601
514           this[UnittestLite.oneofNestedMessageExtensionLite] =
515             TestAllTypesLiteKt.nestedMessage { bb = 602 }
516           this[UnittestLite.oneofStringExtensionLite] = "603"
517           this[UnittestLite.oneofBytesExtensionLite] = toBytes("604")
518         }
519       )
520       .isEqualTo(TestUtilLite.getAllLiteExtensionsSet())
521   }
522 
523   @Test
testExtensionGettersnull524   fun testExtensionGetters() {
525     testAllExtensionsLite {
526       this[UnittestLite.optionalInt32ExtensionLite] = 101
527       assertThat(this[UnittestLite.optionalInt32ExtensionLite]).isEqualTo(101)
528       this[UnittestLite.optionalStringExtensionLite] = "115"
529       assertThat(this[UnittestLite.optionalStringExtensionLite]).isEqualTo("115")
530       this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
531       assertThat(this[UnittestLite.optionalGroupExtensionLite])
532         .isEqualTo(optionalGroupExtensionLite { a = 117 })
533       this[UnittestLite.optionalNestedMessageExtensionLite] =
534         TestAllTypesLiteKt.nestedMessage { bb = 118 }
535       assertThat(this[UnittestLite.optionalNestedMessageExtensionLite])
536         .isEqualTo(TestAllTypesLiteKt.nestedMessage { bb = 118 })
537       this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
538       assertThat(this[UnittestLite.optionalNestedEnumExtensionLite]).isEqualTo(NestedEnum.BAZ)
539       this[UnittestLite.defaultInt32ExtensionLite] = 401
540       assertThat(this[UnittestLite.defaultInt32ExtensionLite]).isEqualTo(401)
541       this[UnittestLite.oneofUint32ExtensionLite] = 601
542       assertThat(this[UnittestLite.oneofUint32ExtensionLite]).isEqualTo(601)
543     }
544   }
545 
546   @Test
testRepeatedExtensionGettersAndSettersnull547   fun testRepeatedExtensionGettersAndSetters() {
548     testAllExtensionsLite {
549       this[UnittestLite.repeatedInt32ExtensionLite].addAll(listOf(1, 2))
550       assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(1, 2))
551       this[UnittestLite.repeatedInt32ExtensionLite] += listOf(3, 4)
552       assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(1, 2, 3, 4))
553       this[UnittestLite.repeatedInt32ExtensionLite][0] = 5
554       assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(5, 2, 3, 4))
555 
556       this[UnittestLite.repeatedStringExtensionLite].addAll(listOf("1", "2"))
557       assertThat(this[UnittestLite.repeatedStringExtensionLite]).isEqualTo(listOf("1", "2"))
558       this[UnittestLite.repeatedStringExtensionLite] += listOf("3", "4")
559       assertThat(this[UnittestLite.repeatedStringExtensionLite])
560         .isEqualTo(listOf("1", "2", "3", "4"))
561       this[UnittestLite.repeatedStringExtensionLite][0] = "5"
562       assertThat(this[UnittestLite.repeatedStringExtensionLite])
563         .isEqualTo(listOf("5", "2", "3", "4"))
564 
565       this[UnittestLite.repeatedGroupExtensionLite].addAll(
566         listOf(repeatedGroupExtensionLite { a = 1 }, repeatedGroupExtensionLite { a = 2 })
567       )
568       assertThat(this[UnittestLite.repeatedGroupExtensionLite])
569         .isEqualTo(
570           listOf(repeatedGroupExtensionLite { a = 1 }, repeatedGroupExtensionLite { a = 2 })
571         )
572       this[UnittestLite.repeatedGroupExtensionLite] +=
573         listOf(repeatedGroupExtensionLite { a = 3 }, repeatedGroupExtensionLite { a = 4 })
574       assertThat(this[UnittestLite.repeatedGroupExtensionLite])
575         .isEqualTo(
576           listOf(
577             repeatedGroupExtensionLite { a = 1 },
578             repeatedGroupExtensionLite { a = 2 },
579             repeatedGroupExtensionLite { a = 3 },
580             repeatedGroupExtensionLite { a = 4 }
581           )
582         )
583       this[UnittestLite.repeatedGroupExtensionLite][0] = repeatedGroupExtensionLite { a = 5 }
584       assertThat(this[UnittestLite.repeatedGroupExtensionLite])
585         .isEqualTo(
586           listOf(
587             repeatedGroupExtensionLite { a = 5 },
588             repeatedGroupExtensionLite { a = 2 },
589             repeatedGroupExtensionLite { a = 3 },
590             repeatedGroupExtensionLite { a = 4 }
591           )
592         )
593 
594       this[UnittestLite.repeatedNestedMessageExtensionLite].addAll(
595         listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 })
596       )
597       assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite])
598         .isEqualTo(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
599       this[UnittestLite.repeatedNestedMessageExtensionLite] +=
600         listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
601       assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite])
602         .isEqualTo(
603           listOf(
604             nestedMessage { bb = 1 },
605             nestedMessage { bb = 2 },
606             nestedMessage { bb = 3 },
607             nestedMessage { bb = 4 }
608           )
609         )
610       this[UnittestLite.repeatedNestedMessageExtensionLite][0] = nestedMessage { bb = 5 }
611       assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite])
612         .isEqualTo(
613           listOf(
614             nestedMessage { bb = 5 },
615             nestedMessage { bb = 2 },
616             nestedMessage { bb = 3 },
617             nestedMessage { bb = 4 }
618           )
619         )
620 
621       this[UnittestLite.repeatedNestedEnumExtensionLite].addAll(
622         listOf(NestedEnum.FOO, NestedEnum.BAR)
623       )
624       assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite])
625         .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
626       this[UnittestLite.repeatedNestedEnumExtensionLite] += listOf(NestedEnum.BAZ, NestedEnum.FOO)
627       assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite])
628         .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
629       this[UnittestLite.repeatedNestedEnumExtensionLite][0] = NestedEnum.BAR
630       assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite])
631         .isEqualTo(listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
632     }
633   }
634 
635   @Test
testExtensionContainsnull636   fun testExtensionContains() {
637     testAllExtensionsLite {
638       this[UnittestLite.optionalInt32ExtensionLite] = 101
639       assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isTrue()
640       assertThat(contains(UnittestLite.optionalStringExtensionLite)).isFalse()
641       this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
642       assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isTrue()
643       assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isFalse()
644       this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
645       assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isTrue()
646       assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isFalse()
647       this[UnittestLite.oneofUint32ExtensionLite] = 601
648       assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isTrue()
649     }
650 
651     testAllExtensionsLite {
652       assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isFalse()
653       this[UnittestLite.optionalStringExtensionLite] = "115"
654       assertThat(contains(UnittestLite.optionalStringExtensionLite)).isTrue()
655       assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isFalse()
656       this[UnittestLite.optionalNestedMessageExtensionLite] =
657         TestAllTypesLiteKt.nestedMessage { bb = 118 }
658       assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isTrue()
659       assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isFalse()
660       this[UnittestLite.defaultInt32ExtensionLite] = 401
661       assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isTrue()
662       assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isFalse()
663     }
664   }
665 
666   @Test
testExtensionClearsnull667   fun testExtensionClears() {
668     testAllExtensionsLite {
669       this[UnittestLite.optionalInt32ExtensionLite] = 101
670       clear(UnittestLite.optionalInt32ExtensionLite)
671       assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isFalse()
672 
673       this[UnittestLite.optionalStringExtensionLite] = "115"
674       clear(UnittestLite.optionalStringExtensionLite)
675       assertThat(contains(UnittestLite.optionalStringExtensionLite)).isFalse()
676 
677       this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
678       clear(UnittestLite.optionalGroupExtensionLite)
679       assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isFalse()
680 
681       this[UnittestLite.optionalNestedMessageExtensionLite] =
682         TestAllTypesLiteKt.nestedMessage { bb = 118 }
683       clear(UnittestLite.optionalNestedMessageExtensionLite)
684       assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isFalse()
685 
686       this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
687       clear(UnittestLite.optionalNestedEnumExtensionLite)
688       assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isFalse()
689 
690       this[UnittestLite.defaultInt32ExtensionLite] = 401
691       clear(UnittestLite.defaultInt32ExtensionLite)
692       assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isFalse()
693 
694       this[UnittestLite.oneofUint32ExtensionLite] = 601
695       clear(UnittestLite.oneofUint32ExtensionLite)
696       assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isFalse()
697     }
698   }
699 
700   @Test
testEmptyMessagesnull701   fun testEmptyMessages() {
702     assertThat(testEmptyMessageLite {}).isEqualTo(TestEmptyMessageLite.newBuilder().build())
703 
704     assertThat(testEmptyMessageWithExtensionsLite {})
705       .isEqualTo(TestEmptyMessageWithExtensionsLite.newBuilder().build())
706   }
707 
708   @Test
testMapSettersnull709   fun testMapSetters() {
710     assertThat(
711         testMapLite {
712           mapInt32Int32[1] = 2
713           mapInt64Int64[1L] = 2L
714           mapUint32Uint32[1] = 2
715           mapUint64Uint64[1L] = 2L
716           mapSint32Sint32[1] = 2
717           mapSint64Sint64[1L] = 2L
718           mapFixed32Fixed32[1] = 2
719           mapFixed64Fixed64[1L] = 2L
720           mapSfixed32Sfixed32[1] = 2
721           mapSfixed64Sfixed64[1L] = 2L
722           mapInt32Float[1] = 2F
723           mapInt32Double[1] = 2.0
724           mapBoolBool[true] = true
725           mapStringString["1"] = "2"
726           mapInt32Bytes[1] = toBytes("2")
727           mapInt32Enum[1] = MapEnumLite.MAP_ENUM_FOO_LITE
728           mapInt32ForeignMessage[1] = foreignMessageLite { c = 1 }
729         }
730       )
731       .isEqualTo(
732         TestMapLite.newBuilder()
733           .putMapInt32Int32(1, 2)
734           .putMapInt64Int64(1L, 2L)
735           .putMapUint32Uint32(1, 2)
736           .putMapUint64Uint64(1L, 2L)
737           .putMapSint32Sint32(1, 2)
738           .putMapSint64Sint64(1L, 2L)
739           .putMapFixed32Fixed32(1, 2)
740           .putMapFixed64Fixed64(1L, 2L)
741           .putMapSfixed32Sfixed32(1, 2)
742           .putMapSfixed64Sfixed64(1L, 2L)
743           .putMapInt32Float(1, 2F)
744           .putMapInt32Double(1, 2.0)
745           .putMapBoolBool(true, true)
746           .putMapStringString("1", "2")
747           .putMapInt32Bytes(1, toBytes("2"))
748           .putMapInt32Enum(1, MapEnumLite.MAP_ENUM_FOO_LITE)
749           .putMapInt32ForeignMessage(1, foreignMessageLite { c = 1 })
750           .build()
751       )
752   }
753 
754   @Test
testMapGettersAndSettersnull755   fun testMapGettersAndSetters() {
756     testMapLite {
757       mapInt32Int32.put(1, 2)
758       assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2))
759       mapInt32Int32[3] = 4
760       assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2, 3 to 4))
761       mapInt32Int32.putAll(mapOf(5 to 6, 7 to 8))
762       assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2, 3 to 4, 5 to 6, 7 to 8))
763 
764       mapStringString.put("1", "2")
765       assertThat(mapStringString).isEqualTo(mapOf("1" to "2"))
766       mapStringString["3"] = "4"
767       assertThat(mapStringString).isEqualTo(mapOf("1" to "2", "3" to "4"))
768       mapStringString.putAll(mapOf("5" to "6", "7" to "8"))
769       assertThat(mapStringString).isEqualTo(mapOf("1" to "2", "3" to "4", "5" to "6", "7" to "8"))
770 
771       mapInt32Enum.put(1, MapEnumLite.MAP_ENUM_FOO_LITE)
772       assertThat(mapInt32Enum).isEqualTo(mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE))
773       mapInt32Enum[2] = MapEnumLite.MAP_ENUM_BAR_LITE
774       assertThat(mapInt32Enum)
775         .isEqualTo(mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE))
776       mapInt32Enum.putAll(
777         mapOf(3 to MapEnumLite.MAP_ENUM_BAZ_LITE, 4 to MapEnumLite.MAP_ENUM_FOO_LITE)
778       )
779       assertThat(mapInt32Enum)
780         .isEqualTo(
781           mapOf(
782             1 to MapEnumLite.MAP_ENUM_FOO_LITE,
783             2 to MapEnumLite.MAP_ENUM_BAR_LITE,
784             3 to MapEnumLite.MAP_ENUM_BAZ_LITE,
785             4 to MapEnumLite.MAP_ENUM_FOO_LITE
786           )
787         )
788 
789       mapInt32ForeignMessage.put(1, foreignMessageLite { c = 1 })
790       assertThat(mapInt32ForeignMessage).isEqualTo(mapOf(1 to foreignMessageLite { c = 1 }))
791       mapInt32ForeignMessage[2] = foreignMessageLite { c = 2 }
792       assertThat(mapInt32ForeignMessage)
793         .isEqualTo(mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 }))
794       mapInt32ForeignMessage.putAll(
795         mapOf(3 to foreignMessageLite { c = 3 }, 4 to foreignMessageLite { c = 4 })
796       )
797       assertThat(mapInt32ForeignMessage)
798         .isEqualTo(
799           mapOf(
800             1 to foreignMessageLite { c = 1 },
801             2 to foreignMessageLite { c = 2 },
802             3 to foreignMessageLite { c = 3 },
803             4 to foreignMessageLite { c = 4 }
804           )
805         )
806     }
807   }
808 
809   @Test
testMapRemovenull810   fun testMapRemove() {
811     testMapLite {
812       mapInt32Int32.putAll(mapOf(1 to 2, 3 to 4))
813       mapInt32Int32.remove(1)
814       assertThat(mapInt32Int32).isEqualTo(mapOf(3 to 4))
815 
816       mapStringString.putAll(mapOf("1" to "2", "3" to "4"))
817       mapStringString.remove("1")
818       assertThat(mapStringString).isEqualTo(mapOf("3" to "4"))
819 
820       mapInt32Enum.putAll(
821         mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE)
822       )
823       mapInt32Enum.remove(1)
824       assertThat(mapInt32Enum).isEqualTo(mapOf(2 to MapEnumLite.MAP_ENUM_BAR_LITE))
825 
826       mapInt32ForeignMessage.putAll(
827         mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 })
828       )
829       mapInt32ForeignMessage.remove(1)
830       assertThat(mapInt32ForeignMessage).isEqualTo(mapOf(2 to foreignMessageLite { c = 2 }))
831     }
832   }
833 
834   @Test
testMapClearnull835   fun testMapClear() {
836     testMapLite {
837       mapInt32Int32.putAll(mapOf(1 to 2, 3 to 4))
838       mapInt32Int32.clear()
839       assertThat(mapInt32Int32.isEmpty()).isTrue()
840 
841       mapStringString.putAll(mapOf("1" to "2", "3" to "4"))
842       mapStringString.clear()
843       assertThat(mapStringString.isEmpty()).isTrue()
844 
845       mapInt32Enum.putAll(
846         mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE)
847       )
848       mapInt32Enum.clear()
849       assertThat(mapInt32Enum.isEmpty()).isTrue()
850 
851       mapInt32ForeignMessage.putAll(
852         mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 })
853       )
854       mapInt32ForeignMessage.clear()
855       assertThat(mapInt32ForeignMessage.isEmpty()).isTrue()
856     }
857   }
858 
859   @Test
testEvilNamesnull860   fun testEvilNames() {
861     assertThat(
862         evilNamesProto2 {
863           initialized = true
864           hasFoo = true
865           bar = "foo"
866           isInitialized = true
867           fooBar = "foo"
868           aLLCAPS += "foo"
869           aLLCAPSMAP[1] = true
870           hasUnderbarPrecedingNumeric1Foo = true
871           hasUnderbarPrecedingNumeric42Bar = true
872           hasUnderbarPrecedingNumeric123Foo42BarBaz = true
873           extension += "foo"
874           class_ += 1
875           int = 1.0
876           long = true
877           boolean = 1L
878           sealed = "foo"
879           interface_ = 1F
880           in_ = 1
881           object_ = "foo"
882           cachedSize_ = "foo"
883           serializedSize_ = true
884           by = "foo"
885         }
886       )
887       .isEqualTo(
888         EvilNamesProto2.newBuilder()
889           .setInitialized(true)
890           .setHasFoo(true)
891           .setBar("foo")
892           .setIsInitialized(true)
893           .setFooBar("foo")
894           .addALLCAPS("foo")
895           .putALLCAPSMAP(1, true)
896           .setHasUnderbarPrecedingNumeric1Foo(true)
897           .setHasUnderbarPrecedingNumeric42Bar(true)
898           .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
899           .addExtension("foo")
900           .addClass_(1)
901           .setInt(1.0)
902           .setLong(true)
903           .setBoolean(1L)
904           .setSealed("foo")
905           .setInterface(1F)
906           .setIn(1)
907           .setObject("foo")
908           .setCachedSize_("foo")
909           .setSerializedSize_(true)
910           .setBy("foo")
911           .build()
912       )
913 
914     assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build())
915   }
916 
917   @Test
testHardKeywordGettersAndSettersnull918   fun testHardKeywordGettersAndSetters() {
919     hardKeywordsAllTypesProto2 {
920       as_ = 1
921       assertThat(as_).isEqualTo(1)
922 
923       in_ = "foo"
924       assertThat(in_).isEqualTo("foo")
925 
926       break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
927       assertThat(break_).isEqualTo(HardKeywordsAllTypesProto2.NestedEnum.FOO)
928 
929       do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
930       assertThat(do_).isEqualTo(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 })
931 
932       continue_[1] = 1
933       assertThat(continue_[1]).isEqualTo(1)
934 
935       else_ += 1
936       assertThat(else_).isEqualTo(listOf(1))
937 
938       for_ += "foo"
939       assertThat(for_).isEqualTo(listOf("foo"))
940 
941       fun_ += HardKeywordsAllTypesProto2.NestedEnum.FOO
942       assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypesProto2.NestedEnum.FOO))
943 
944       if_ += HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
945       assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }))
946     }
947   }
948 
949   @Test
testHardKeywordHazzersnull950   fun testHardKeywordHazzers() {
951     hardKeywordsAllTypesProto2 {
952       as_ = 1
953       assertThat(hasAs_()).isTrue()
954 
955       in_ = "foo"
956       assertThat(hasIn_()).isTrue()
957 
958       break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
959       assertThat(hasBreak_()).isTrue()
960 
961       do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
962       assertThat(hasDo_()).isTrue()
963     }
964   }
965 
966   @Test
testHardKeywordClearsnull967   fun testHardKeywordClears() {
968     hardKeywordsAllTypesProto2 {
969       as_ = 1
970       clearAs_()
971       assertThat(hasAs_()).isFalse()
972 
973       in_ = "foo"
974       clearIn_()
975       assertThat(hasIn_()).isFalse()
976 
977       break_ = HardKeywordsAllTypesProto2.NestedEnum.FOO
978       clearBreak_()
979       assertThat(hasBreak_()).isFalse()
980 
981       do_ = HardKeywordsAllTypesProto2Kt.nestedMessage { while_ = 1 }
982       clearDo_()
983       assertThat(hasDo_()).isFalse()
984     }
985   }
986 }
987