File tree Expand file tree Collapse file tree
main/java/io/cloudevents/core
test/java/io/cloudevents/core/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,12 +236,12 @@ public String toString() {
236236 "id='" + id + '\'' +
237237 ", source=" + source +
238238 ", 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 +
245245 '}' ;
246246 }
247247}
Original file line number Diff line number Diff line change @@ -223,11 +223,11 @@ public String toString() {
223223 "id='" + id + '\'' +
224224 ", source=" + source +
225225 ", 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 () : "" ) +
231231 ", extensions=" + this .extensions +
232232 '}' ;
233233 }
Original file line number Diff line number Diff line change @@ -91,4 +91,28 @@ public void testGetAttributeNames() {
9191 );
9292 }
9393
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+
94118}
You can’t perform that action at this time.
0 commit comments