|
| 1 | +package com.jayway.jsonpath; |
| 2 | + |
| 3 | +import com.jayway.jsonpath.spi.json.*; |
| 4 | +import org.junit.Test; |
| 5 | + |
| 6 | +public class DeleteMissingPathTest { |
| 7 | + |
| 8 | + private DocumentContext getDocumentContextFromProvider(JsonProvider jsonProvider) { |
| 9 | + |
| 10 | + Configuration configuration = Configuration.builder() |
| 11 | + .jsonProvider(jsonProvider) |
| 12 | + .options(Option.SUPPRESS_EXCEPTIONS) |
| 13 | + .build(); |
| 14 | + |
| 15 | + return JsonPath.parse("{}", configuration); |
| 16 | + } |
| 17 | + |
| 18 | + @Test |
| 19 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_gson() { |
| 20 | + getDocumentContextFromProvider(new GsonJsonProvider()) |
| 21 | + .delete("$..this..path..is..missing"); |
| 22 | + } |
| 23 | + |
| 24 | + @Test |
| 25 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_jackson_json_node() { |
| 26 | + getDocumentContextFromProvider(new JacksonJsonNodeJsonProvider()) |
| 27 | + .delete("$..this..path..is..missing"); |
| 28 | + } |
| 29 | + |
| 30 | + @Test |
| 31 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_jackson() { |
| 32 | + getDocumentContextFromProvider(new JacksonJsonProvider()) |
| 33 | + .delete("$..this..path..is..missing"); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_jakarta() { |
| 38 | + getDocumentContextFromProvider(new JakartaJsonProvider()) |
| 39 | + .delete("$..this..path..is..missing"); |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_jettison() { |
| 44 | + getDocumentContextFromProvider(new JettisonProvider()) |
| 45 | + .delete("$..this..path..is..missing"); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_json_org() { |
| 50 | + getDocumentContextFromProvider(new JsonOrgJsonProvider()) |
| 51 | + .delete("$..this..path..is..missing"); |
| 52 | + } |
| 53 | + |
| 54 | + @Test |
| 55 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_json_smart() { |
| 56 | + getDocumentContextFromProvider(new JsonSmartJsonProvider()) |
| 57 | + .delete("$..this..path..is..missing"); |
| 58 | + } |
| 59 | + |
| 60 | + @Test |
| 61 | + public void test_delete_missing_path_with_suppress_exceptions_does_not_throw_tapestry() { |
| 62 | + getDocumentContextFromProvider(new TapestryJsonProvider()) |
| 63 | + .delete("$..this..path..is..missing"); |
| 64 | + } |
| 65 | +} |
0 commit comments