@@ -55,30 +55,40 @@ func TestStringPropertyTextMsg(t *testing.T) {
55
55
propValue := "myValue"
56
56
57
57
// Test the empty value before the property is set.
58
- assert .Nil (t , txtMsg .GetStringProperty (propName ))
58
+ gotPropValue , propErr := txtMsg .GetStringProperty (propName )
59
+ assert .Nil (t , propErr )
60
+ assert .Nil (t , gotPropValue )
59
61
60
62
// Test the ability to set properties before the message is sent.
61
63
retErr := txtMsg .SetStringProperty (propName , & propValue )
62
64
assert .Nil (t , retErr )
63
- assert .Equal (t , propValue , * txtMsg .GetStringProperty (propName ))
65
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName )
66
+ assert .Nil (t , propErr )
67
+ assert .Equal (t , propValue , * gotPropValue )
64
68
assert .Equal (t , msgBody , * txtMsg .GetText ())
65
69
66
70
// Send an empty string property as well
67
71
emptyPropName := "myEmptyString"
68
72
emptyPropValue := ""
69
73
retErr = txtMsg .SetStringProperty (emptyPropName , & emptyPropValue )
70
74
assert .Nil (t , retErr )
71
- assert .Equal (t , emptyPropValue , * txtMsg .GetStringProperty (emptyPropName ))
75
+ gotPropValue , propErr = txtMsg .GetStringProperty (emptyPropName )
76
+ assert .Nil (t , propErr )
77
+ assert .Equal (t , emptyPropValue , * gotPropValue )
72
78
73
79
// Set a property then try to unset it by setting to nil
74
80
unsetPropName := "mySendThenRemovedString"
75
81
unsetPropValue := "someValueThatWillBeOverwritten"
76
82
retErr = txtMsg .SetStringProperty (unsetPropName , & unsetPropValue )
77
83
assert .Nil (t , retErr )
78
- assert .Equal (t , unsetPropValue , * txtMsg .GetStringProperty (unsetPropName ))
84
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
85
+ assert .Nil (t , propErr )
86
+ assert .Equal (t , unsetPropValue , * gotPropValue )
79
87
retErr = txtMsg .SetStringProperty (unsetPropName , nil )
80
88
assert .Nil (t , retErr )
81
- assert .Nil (t , txtMsg .GetStringProperty (unsetPropName ))
89
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
90
+ assert .Nil (t , propErr )
91
+ assert .Nil (t , gotPropValue )
82
92
83
93
// Set up objects for send/receive
84
94
queue := context .CreateQueue ("DEV.QUEUE.1" )
@@ -104,14 +114,22 @@ func TestStringPropertyTextMsg(t *testing.T) {
104
114
}
105
115
106
116
// Check property is available on received message.
107
- assert .Equal (t , propValue , * rcvMsg .GetStringProperty (propName ))
117
+ gotPropValue , propErr = rcvMsg .GetStringProperty (propName )
118
+ assert .Nil (t , propErr )
119
+ assert .Equal (t , propValue , * gotPropValue )
108
120
109
121
// Check the empty string property.
110
- assert .Equal (t , emptyPropValue , * rcvMsg .GetStringProperty (emptyPropName ))
122
+ gotPropValue , propErr = rcvMsg .GetStringProperty (emptyPropName )
123
+ assert .Nil (t , propErr )
124
+ assert .Equal (t , emptyPropValue , * gotPropValue )
111
125
112
126
// Properties that are not set should return nil
113
- assert .Nil (t , rcvMsg .GetStringProperty ("nonExistentProperty" ))
114
- assert .Nil (t , rcvMsg .GetStringProperty (unsetPropName ))
127
+ gotPropValue , propErr = rcvMsg .GetStringProperty ("nonExistentProperty" )
128
+ assert .Nil (t , propErr )
129
+ assert .Nil (t , gotPropValue )
130
+ gotPropValue , propErr = rcvMsg .GetStringProperty (unsetPropName )
131
+ assert .Nil (t , propErr )
132
+ assert .Nil (t , gotPropValue )
115
133
116
134
}
117
135
@@ -141,7 +159,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
141
159
propValue := "myValue"
142
160
143
161
// Test the empty value before the property is set.
144
- assert .Nil (t , txtMsg .GetStringProperty (propName ))
162
+ gotPropValue , propErr := txtMsg .GetStringProperty (propName )
163
+ assert .Nil (t , propErr )
164
+ assert .Nil (t , gotPropValue )
145
165
propExists , propErr := txtMsg .PropertyExists (propName )
146
166
assert .Nil (t , propErr )
147
167
assert .False (t , propExists )
@@ -152,7 +172,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
152
172
// Test the ability to set properties before the message is sent.
153
173
retErr := txtMsg .SetStringProperty (propName , & propValue )
154
174
assert .Nil (t , retErr )
155
- assert .Equal (t , propValue , * txtMsg .GetStringProperty (propName ))
175
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName )
176
+ assert .Nil (t , propErr )
177
+ assert .Equal (t , propValue , * gotPropValue )
156
178
propExists , propErr = txtMsg .PropertyExists (propName )
157
179
assert .Nil (t , propErr )
158
180
assert .True (t , propExists ) // now exists
@@ -165,7 +187,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
165
187
propValue2 := "myValueTwo"
166
188
retErr = txtMsg .SetStringProperty (propName2 , & propValue2 )
167
189
assert .Nil (t , retErr )
168
- assert .Equal (t , propValue2 , * txtMsg .GetStringProperty (propName2 ))
190
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName2 )
191
+ assert .Nil (t , propErr )
192
+ assert .Equal (t , propValue2 , * gotPropValue )
169
193
propExists , propErr = txtMsg .PropertyExists (propName2 )
170
194
assert .Nil (t , propErr )
171
195
assert .True (t , propExists ) // now exists
@@ -184,7 +208,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
184
208
unsetPropValue := "someValueThatWillBeOverwritten"
185
209
retErr = txtMsg .SetStringProperty (unsetPropName , & unsetPropValue )
186
210
assert .Nil (t , retErr )
187
- assert .Equal (t , unsetPropValue , * txtMsg .GetStringProperty (unsetPropName ))
211
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
212
+ assert .Nil (t , propErr )
213
+ assert .Equal (t , unsetPropValue , * gotPropValue )
188
214
propExists , propErr = txtMsg .PropertyExists (unsetPropName )
189
215
assert .Nil (t , propErr )
190
216
assert .True (t , propExists )
@@ -193,7 +219,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
193
219
assert .Equal (t , 3 , len (allPropNames ))
194
220
retErr = txtMsg .SetStringProperty (unsetPropName , nil )
195
221
assert .Nil (t , retErr )
196
- assert .Nil (t , txtMsg .GetStringProperty (unsetPropName ))
222
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
223
+ assert .Nil (t , propErr )
224
+ assert .Nil (t , gotPropValue )
197
225
propExists , propErr = txtMsg .PropertyExists (unsetPropName )
198
226
assert .Nil (t , propErr )
199
227
assert .False (t , propExists )
@@ -242,7 +270,9 @@ func TestPropertyExistsGetNames(t *testing.T) {
242
270
243
271
// Properties that are not set should return nil
244
272
nonExistentPropName := "nonExistentProperty"
245
- assert .Nil (t , rcvMsg .GetStringProperty (nonExistentPropName ))
273
+ gotPropValue , propErr = rcvMsg .GetStringProperty (nonExistentPropName )
274
+ assert .Nil (t , propErr )
275
+ assert .Nil (t , gotPropValue )
246
276
propExists , propErr = rcvMsg .PropertyExists (nonExistentPropName )
247
277
assert .Nil (t , propErr )
248
278
assert .False (t , propExists )
@@ -282,7 +312,9 @@ func TestPropertyClearProperties(t *testing.T) {
282
312
// Test the ability to set properties before the message is sent.
283
313
retErr := txtMsg .SetStringProperty (propName , & propValue )
284
314
assert .Nil (t , retErr )
285
- assert .Equal (t , propValue , * txtMsg .GetStringProperty (propName ))
315
+ gotPropValue , propErr := txtMsg .GetStringProperty (propName )
316
+ assert .Nil (t , propErr )
317
+ assert .Equal (t , propValue , * gotPropValue )
286
318
propExists , propErr := txtMsg .PropertyExists (propName )
287
319
assert .Nil (t , propErr )
288
320
assert .True (t , propExists ) // now exists
@@ -293,7 +325,9 @@ func TestPropertyClearProperties(t *testing.T) {
293
325
294
326
clearErr := txtMsg .ClearProperties ()
295
327
assert .Nil (t , clearErr )
296
- assert .Nil (t , txtMsg .GetStringProperty (propName ))
328
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName )
329
+ assert .Nil (t , propErr )
330
+ assert .Nil (t , gotPropValue )
297
331
propExists , propErr = txtMsg .PropertyExists (propName )
298
332
assert .Nil (t , propErr )
299
333
assert .False (t , propExists )
@@ -308,10 +342,14 @@ func TestPropertyClearProperties(t *testing.T) {
308
342
// Set multiple properties
309
343
retErr = txtMsg .SetStringProperty (propName , & propValue )
310
344
assert .Nil (t , retErr )
311
- assert .Equal (t , propValue , * txtMsg .GetStringProperty (propName ))
345
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName )
346
+ assert .Nil (t , propErr )
347
+ assert .Equal (t , propValue , * gotPropValue )
312
348
retErr = txtMsg .SetStringProperty (propName2 , & propValue2 )
313
349
assert .Nil (t , retErr )
314
- assert .Equal (t , propValue2 , * txtMsg .GetStringProperty (propName2 ))
350
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName2 )
351
+ assert .Nil (t , propErr )
352
+ assert .Equal (t , propValue2 , * gotPropValue )
315
353
propExists , propErr = txtMsg .PropertyExists (propName2 )
316
354
assert .Nil (t , propErr )
317
355
assert .True (t , propExists ) // now exists
@@ -329,7 +367,9 @@ func TestPropertyClearProperties(t *testing.T) {
329
367
unsetPropValue := "someValueThatWillBeOverwritten"
330
368
retErr = txtMsg .SetStringProperty (unsetPropName , & unsetPropValue )
331
369
assert .Nil (t , retErr )
332
- assert .Equal (t , unsetPropValue , * txtMsg .GetStringProperty (unsetPropName ))
370
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
371
+ assert .Nil (t , propErr )
372
+ assert .Equal (t , unsetPropValue , * gotPropValue )
333
373
propExists , propErr = txtMsg .PropertyExists (unsetPropName )
334
374
assert .Nil (t , propErr )
335
375
assert .True (t , propExists )
@@ -341,7 +381,9 @@ func TestPropertyClearProperties(t *testing.T) {
341
381
assert .Equal (t , unsetPropName , allPropNames [2 ])
342
382
retErr = txtMsg .SetStringProperty (unsetPropName , nil )
343
383
assert .Nil (t , retErr )
344
- assert .Nil (t , txtMsg .GetStringProperty (unsetPropName ))
384
+ gotPropValue , propErr = txtMsg .GetStringProperty (unsetPropName )
385
+ assert .Nil (t , propErr )
386
+ assert .Nil (t , gotPropValue )
345
387
propExists , propErr = txtMsg .PropertyExists (unsetPropName )
346
388
assert .Nil (t , propErr )
347
389
assert .False (t , propExists )
@@ -353,7 +395,9 @@ func TestPropertyClearProperties(t *testing.T) {
353
395
354
396
clearErr = txtMsg .ClearProperties ()
355
397
assert .Nil (t , clearErr )
356
- assert .Nil (t , txtMsg .GetStringProperty (propName ))
398
+ gotPropValue , propErr = txtMsg .GetStringProperty (propName )
399
+ assert .Nil (t , propErr )
400
+ assert .Nil (t , gotPropValue )
357
401
propExists , propErr = txtMsg .PropertyExists (propName )
358
402
assert .Nil (t , propErr )
359
403
assert .False (t , propExists )
@@ -399,7 +443,9 @@ func TestPropertyClearProperties(t *testing.T) {
399
443
400
444
// Properties that are not set should return nil
401
445
nonExistentPropName := "nonExistentProperty"
402
- assert .Nil (t , rcvMsg .GetStringProperty (nonExistentPropName ))
446
+ gotPropValue , propErr = rcvMsg .GetStringProperty (nonExistentPropName )
447
+ assert .Nil (t , propErr )
448
+ assert .Nil (t , gotPropValue )
403
449
propExists , propErr = rcvMsg .PropertyExists (nonExistentPropName )
404
450
assert .Nil (t , propErr )
405
451
assert .False (t , propExists )
@@ -412,7 +458,9 @@ func TestPropertyClearProperties(t *testing.T) {
412
458
// Finally try clearing everything on the received message
413
459
clearErr = rcvMsg .ClearProperties ()
414
460
assert .Nil (t , clearErr )
415
- assert .Nil (t , rcvMsg .GetStringProperty (propName ))
461
+ gotPropValue , propErr = rcvMsg .GetStringProperty (propName )
462
+ assert .Nil (t , propErr )
463
+ assert .Nil (t , gotPropValue )
416
464
propExists , propErr = rcvMsg .PropertyExists (propName )
417
465
assert .Nil (t , propErr )
418
466
assert .False (t , propExists )
@@ -471,7 +519,9 @@ func TestStringPropertyTextMessageNilBody(t *testing.T) {
471
519
}
472
520
473
521
// Check property is available on received message.
474
- assert .Equal (t , propValue , * rcvMsg .GetStringProperty (propName ))
522
+ gotPropValue , propErr := rcvMsg .GetStringProperty (propName )
523
+ assert .Nil (t , propErr )
524
+ assert .Equal (t , propValue , * gotPropValue )
475
525
476
526
}
477
527
@@ -535,7 +585,11 @@ func TestStringPropertyTextMessageEmptyBody(t *testing.T) {
535
585
}
536
586
537
587
// Check property is available on received message.
538
- assert .Equal (t , propAValue , * rcvMsg .GetStringProperty (propAName ))
539
- assert .Equal (t , propBValue , * rcvMsg .GetStringProperty (propBName ))
588
+ gotPropValue , propErr := rcvMsg .GetStringProperty (propAName )
589
+ assert .Nil (t , propErr )
590
+ assert .Equal (t , propAValue , * gotPropValue )
591
+ gotPropValue , propErr = rcvMsg .GetStringProperty (propBName )
592
+ assert .Nil (t , propErr )
593
+ assert .Equal (t , propBValue , * gotPropValue )
540
594
541
595
}
0 commit comments