@@ -15,27 +15,27 @@ public class ErrorDetailsTest {
1515 public void testDeserializeFromArray () throws Exception {
1616 String json =
1717 "["
18- + "{"
19- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
20- + "\" reason\" : \" PERMISSION_DENIED\" ,"
21- + "\" domain\" : \" databricks.com\" ,"
22- + "\" metadata\" : {"
23- + "\" service\" : \" workspace\" "
24- + "}"
25- + "},"
26- + "{"
27- + "\" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
28- + "\" request_id\" : \" req-123\" ,"
29- + "\" serving_data\" : \" stack-trace-data\" "
30- + "},"
31- + "{"
32- + "\" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
33- + "\" retry_delay\" : \" 30s\" "
34- + "},"
35- + "{"
36- + "\" @type\" : \" unknown.type\" ,"
37- + "\" custom_field\" : \" custom_value\" "
38- + "}"
18+ + " {"
19+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
20+ + " \" reason\" : \" PERMISSION_DENIED\" ,"
21+ + " \" domain\" : \" databricks.com\" ,"
22+ + " \" metadata\" : {"
23+ + " \" service\" : \" workspace\" "
24+ + " }"
25+ + " },"
26+ + " {"
27+ + " \" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
28+ + " \" request_id\" : \" req-123\" ,"
29+ + " \" serving_data\" : \" stack-trace-data\" "
30+ + " },"
31+ + " {"
32+ + " \" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
33+ + " \" retry_delay\" : \" 30s\" "
34+ + " },"
35+ + " {"
36+ + " \" @type\" : \" unknown.type\" ,"
37+ + " \" custom_field\" : \" custom_value\" "
38+ + " }"
3939 + "]" ;
4040
4141 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
@@ -61,12 +61,12 @@ public void testDeserializeFromArray() throws Exception {
6161 public void testDeserializeFromSingleObject () throws Exception {
6262 String json =
6363 "{"
64- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
65- + "\" reason\" : \" RESOURCE_EXHAUSTED\" ,"
66- + "\" domain\" : \" databricks.com\" ,"
67- + "\" metadata\" : {"
68- + "\" quota_limit\" : \" 1000\" "
69- + "}"
64+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
65+ + " \" reason\" : \" RESOURCE_EXHAUSTED\" ,"
66+ + " \" domain\" : \" databricks.com\" ,"
67+ + " \" metadata\" : {"
68+ + " \" quota_limit\" : \" 1000\" "
69+ + " }"
7070 + "}" ;
7171
7272 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
@@ -83,27 +83,27 @@ public void testDeserializeFromSingleObject() throws Exception {
8383 public void testDeserializeFromArrayWithMixedTypes () throws Exception {
8484 String json =
8585 "["
86- + "{"
87- + "\" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
88- + "\" violations\" : ["
89- + "{"
90- + "\" subject\" : \" project:123\" ,"
91- + "\" description\" : \" Daily limit exceeded\" "
92- + "}"
93- + "]"
94- + "},"
95- + "{"
96- + "\" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
97- + "\" links\" : ["
98- + "{"
99- + "\" description\" : \" Quota documentation\" ,"
100- + "\" url\" : \" https://docs.databricks.com/quota\" "
101- + "}"
102- + "]"
103- + "},"
104- + "{"
105- + "\" unrecognized_field\" : \" value\" "
106- + "}"
86+ + " {"
87+ + " \" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
88+ + " \" violations\" : ["
89+ + " {"
90+ + " \" subject\" : \" project:123\" ,"
91+ + " \" description\" : \" Daily limit exceeded\" "
92+ + " }"
93+ + " ]"
94+ + " },"
95+ + " {"
96+ + " \" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
97+ + " \" links\" : ["
98+ + " {"
99+ + " \" description\" : \" Quota documentation\" ,"
100+ + " \" url\" : \" https://docs.databricks.com/quota\" "
101+ + " }"
102+ + " ]"
103+ + " },"
104+ + " {"
105+ + " \" unrecognized_field\" : \" value\" "
106+ + " }"
107107 + "]" ;
108108
109109 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
@@ -148,49 +148,49 @@ public void testDeserializeEmptyArray() throws Exception {
148148 public void testDeserializeAllErrorDetailTypes () throws Exception {
149149 String json =
150150 "["
151- + "{"
152- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
153- + "\" reason\" : \" reason\" ,"
154- + "\" domain\" : \" domain\" ,"
155- + "\" metadata\" : {\" k1\" : \" v1\" , \" k2\" : \" v2\" }"
156- + "},"
157- + "{"
158- + "\" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
159- + "\" request_id\" : \" req42\" ,"
160- + "\" serving_data\" : \" data\" "
161- + "},"
162- + "{"
163- + "\" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
164- + "\" retry_delay\" : \" 1.000000001s\" "
165- + "},"
166- + "{"
167- + "\" @type\" : \" type.googleapis.com/google.rpc.DebugInfo\" ,"
168- + "\" stack_entries\" : [\" entry1\" , \" entry2\" ],"
169- + "\" detail\" : \" detail\" "
170- + "},"
171- + "{"
172- + "\" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
173- + "\" violations\" : [{\" subject\" : \" subject\" , \" description\" : \" description\" }]"
174- + "},"
175- + "{"
176- + "\" @type\" : \" type.googleapis.com/google.rpc.PreconditionFailure\" ,"
177- + "\" violations\" : [{\" type\" : \" type\" , \" subject\" : \" subject\" , \" description\" : \" description\" }]"
178- + "},"
179- + "{"
180- + "\" @type\" : \" type.googleapis.com/google.rpc.BadRequest\" ,"
181- + "\" field_violations\" : [{\" field\" : \" field\" , \" description\" : \" description\" }]"
182- + "},"
183- + "{"
184- + "\" @type\" : \" type.googleapis.com/google.rpc.ResourceInfo\" ,"
185- + "\" resource_type\" : \" resource_type\" ,"
186- + "\" resource_name\" : \" resource_name\" ,"
187- + "\" owner\" : \" owner\" ,"
188- + "\" description\" : \" description\" "
189- + "},"
190- + "{"
191- + "\" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
192- + "\" links\" : [{\" description\" : \" description\" , \" url\" : \" url\" }]"
193- + "}"
151+ + " {"
152+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
153+ + " \" reason\" : \" reason\" ,"
154+ + " \" domain\" : \" domain\" ,"
155+ + " \" metadata\" : {\" k1\" : \" v1\" , \" k2\" : \" v2\" }"
156+ + " },"
157+ + " {"
158+ + " \" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
159+ + " \" request_id\" : \" req42\" ,"
160+ + " \" serving_data\" : \" data\" "
161+ + " },"
162+ + " {"
163+ + " \" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
164+ + " \" retry_delay\" : \" 1.000000001s\" "
165+ + " },"
166+ + " {"
167+ + " \" @type\" : \" type.googleapis.com/google.rpc.DebugInfo\" ,"
168+ + " \" stack_entries\" : [\" entry1\" , \" entry2\" ],"
169+ + " \" detail\" : \" detail\" "
170+ + " },"
171+ + " {"
172+ + " \" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
173+ + " \" violations\" : [{\" subject\" : \" subject\" , \" description\" : \" description\" }]"
174+ + " },"
175+ + " {"
176+ + " \" @type\" : \" type.googleapis.com/google.rpc.PreconditionFailure\" ,"
177+ + " \" violations\" : [{\" type\" : \" type\" , \" subject\" : \" subject\" , \" description\" : \" description\" }]"
178+ + " },"
179+ + " {"
180+ + " \" @type\" : \" type.googleapis.com/google.rpc.BadRequest\" ,"
181+ + " \" field_violations\" : [{\" field\" : \" field\" , \" description\" : \" description\" }]"
182+ + " },"
183+ + " {"
184+ + " \" @type\" : \" type.googleapis.com/google.rpc.ResourceInfo\" ,"
185+ + " \" resource_type\" : \" resource_type\" ,"
186+ + " \" resource_name\" : \" resource_name\" ,"
187+ + " \" owner\" : \" owner\" ,"
188+ + " \" description\" : \" description\" "
189+ + " },"
190+ + " {"
191+ + " \" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
192+ + " \" links\" : [{\" description\" : \" description\" , \" url\" : \" url\" }]"
193+ + " }"
194194 + "]" ;
195195
196196 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
@@ -250,7 +250,8 @@ public void testDeserializeAllErrorDetailTypes() throws Exception {
250250
251251 @ Test
252252 public void testDeserializeUnknownErrorDetailType () throws Exception {
253- String json = "[" + "{" + "\" @type\" : \" foo\" ," + "\" reason\" : \" reason\" " + "}" + "]" ;
253+ String json =
254+ "[" + " {" + " \" @type\" : \" foo\" ," + " \" reason\" : \" reason\" " + " }" + "]" ;
254255
255256 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
256257
@@ -276,45 +277,45 @@ public void testDeserializeUnknownErrorDetailType() throws Exception {
276277 public void testDeserializeInvalidErrorDetails () throws Exception {
277278 String json =
278279 "["
279- + "42,"
280- + "\" foobar\" ,"
281- + "{\" foo\" : \" bar\" },"
282- + "{"
283- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
284- + "\" reason\" : 0"
285- + "},"
286- + "{"
287- + "\" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
288- + "\" request_id\" : 0"
289- + "},"
290- + "{"
291- + "\" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
292- + "\" retry_delay\" : 0"
293- + "},"
294- + "{"
295- + "\" @type\" : \" type.googleapis.com/google.rpc.DebugInfo\" ,"
296- + "\" stack_entries\" : 0"
297- + "},"
298- + "{"
299- + "\" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
300- + "\" violations\" : 0"
301- + "},"
302- + "{"
303- + "\" @type\" : \" type.googleapis.com/google.rpc.PreconditionFailure\" ,"
304- + "\" violations\" : 0"
305- + "},"
306- + "{"
307- + "\" @type\" : \" type.googleapis.com/google.rpc.BadRequest\" ,"
308- + "\" field_violations\" : 0"
309- + "},"
310- + "{"
311- + "\" @type\" : \" type.googleapis.com/google.rpc.ResourceInfo\" ,"
312- + "\" resource_type\" : 0"
313- + "},"
314- + "{"
315- + "\" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
316- + "\" links\" : 0"
317- + "}"
280+ + " 42,"
281+ + " \" foobar\" ,"
282+ + " {\" foo\" : \" bar\" },"
283+ + " {"
284+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
285+ + " \" reason\" : 0"
286+ + " },"
287+ + " {"
288+ + " \" @type\" : \" type.googleapis.com/google.rpc.RequestInfo\" ,"
289+ + " \" request_id\" : 0"
290+ + " },"
291+ + " {"
292+ + " \" @type\" : \" type.googleapis.com/google.rpc.RetryInfo\" ,"
293+ + " \" retry_delay\" : 0"
294+ + " },"
295+ + " {"
296+ + " \" @type\" : \" type.googleapis.com/google.rpc.DebugInfo\" ,"
297+ + " \" stack_entries\" : 0"
298+ + " },"
299+ + " {"
300+ + " \" @type\" : \" type.googleapis.com/google.rpc.QuotaFailure\" ,"
301+ + " \" violations\" : 0"
302+ + " },"
303+ + " {"
304+ + " \" @type\" : \" type.googleapis.com/google.rpc.PreconditionFailure\" ,"
305+ + " \" violations\" : 0"
306+ + " },"
307+ + " {"
308+ + " \" @type\" : \" type.googleapis.com/google.rpc.BadRequest\" ,"
309+ + " \" field_violations\" : 0"
310+ + " },"
311+ + " {"
312+ + " \" @type\" : \" type.googleapis.com/google.rpc.ResourceInfo\" ,"
313+ + " \" resource_type\" : 0"
314+ + " },"
315+ + " {"
316+ + " \" @type\" : \" type.googleapis.com/google.rpc.Help\" ,"
317+ + " \" links\" : 0"
318+ + " }"
318319 + "]" ;
319320
320321 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
@@ -374,18 +375,18 @@ public void testDeserializeInvalidErrorDetails() throws Exception {
374375 public void testDeserializeLastErrorDetailWins () throws Exception {
375376 String json =
376377 "["
377- + "{"
378- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
379- + "\" reason\" : \" first\" ,"
380- + "\" domain\" : \" test\" ,"
381- + "\" metadata\" : {}"
382- + "},"
383- + "{"
384- + "\" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
385- + "\" reason\" : \" second\" ,"
386- + "\" domain\" : \" test\" ,"
387- + "\" metadata\" : {}"
388- + "}"
378+ + " {"
379+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
380+ + " \" reason\" : \" first\" ,"
381+ + " \" domain\" : \" test\" ,"
382+ + " \" metadata\" : {}"
383+ + " },"
384+ + " {"
385+ + " \" @type\" : \" type.googleapis.com/google.rpc.ErrorInfo\" ,"
386+ + " \" reason\" : \" second\" ,"
387+ + " \" domain\" : \" test\" ,"
388+ + " \" metadata\" : {}"
389+ + " }"
389390 + "]" ;
390391
391392 ErrorDetails errorDetails = mapper .readValue (json , ErrorDetails .class );
0 commit comments