File tree Expand file tree Collapse file tree 3 files changed +35
-11
lines changed
main/java/io/cloudevents/core
test/java/io/cloudevents/core/impl Expand file tree Collapse file tree 3 files changed +35
-11
lines changed Original file line number Diff line number Diff line change @@ -236,12 +236,12 @@ public String toString() {
236
236
"id='" + id + '\'' +
237
237
", source=" + source +
238
238
", type='" + type + '\'' +
239
- ", datacontenttype='" + datacontenttype + '\'' +
240
- ", schemaurl=" + schemaurl +
241
- ", subject='" + subject + '\'' +
242
- ", time=" + time +
243
- ", data=" + getData () +
244
- ", extensions" + this .extensions +
239
+ (( datacontenttype != null ) ? ", datacontenttype='" + datacontenttype + '\'' : "" ) +
240
+ (( schemaurl != null ) ? ", schemaurl=" + schemaurl : "" ) +
241
+ (( subject != null ) ? ", subject='" + subject + '\'' : "" ) +
242
+ (( time != null ) ? ", time=" + time : "" ) +
243
+ (( getData () != null ) ? ", data=" + getData () : "" ) +
244
+ ", extensions= " + this .extensions +
245
245
'}' ;
246
246
}
247
247
}
Original file line number Diff line number Diff line change @@ -223,11 +223,11 @@ public String toString() {
223
223
"id='" + id + '\'' +
224
224
", source=" + source +
225
225
", type='" + type + '\'' +
226
- ", datacontenttype='" + datacontenttype + '\'' +
227
- ", dataschema=" + dataschema +
228
- ", subject='" + subject + '\'' +
229
- ", time=" + time +
230
- ", data=" + getData () +
226
+ (( datacontenttype != null ) ? ", datacontenttype='" + datacontenttype + '\'' : "" ) +
227
+ (( dataschema != null ) ? ", dataschema=" + dataschema : "" ) +
228
+ (( subject != null ) ? ", subject='" + subject + '\'' : "" ) +
229
+ (( time != null ) ? ", time=" + time : "" ) +
230
+ (( getData () != null ) ? ", data=" + getData () : "" ) +
231
231
", extensions=" + this .extensions +
232
232
'}' ;
233
233
}
Original file line number Diff line number Diff line change @@ -91,4 +91,28 @@ public void testGetAttributeNames() {
91
91
);
92
92
}
93
93
94
+ @ Test
95
+ public void testToStringV1 () {
96
+ CloudEvent event = CloudEventBuilder .v1 ()
97
+ .withId (ID )
98
+ .withType (TYPE )
99
+ .withSource (SOURCE )
100
+ .build ();
101
+
102
+ assertThat (event .toString ())
103
+ .doesNotContain ("time" );
104
+ }
105
+
106
+ @ Test
107
+ public void testToStringV03 () {
108
+ CloudEvent event = CloudEventBuilder .v03 ()
109
+ .withId (ID )
110
+ .withType (TYPE )
111
+ .withSource (SOURCE )
112
+ .build ();
113
+
114
+ assertThat (event .toString ())
115
+ .doesNotContain ("time" );
116
+ }
117
+
94
118
}
You can’t perform that action at this time.
0 commit comments