Class JsonAssertions


  • public final class JsonAssertions
    extends Object
    • Method Detail

      • assertThatJson

        @NotNull
        public static @NotNull JsonAssert.ConfigurableJsonAssert assertThatJson​(@NotNull
                                                                                @NotNull Object actual,
                                                                                @NotNull
                                                                                @NotNull JsonAssertions.JsonAssertionCallback... callbacks)
        Assert json properties with possibility to chain assertion callbacks like this
        
         assertThatJson("{\"test1\":2, \"test2\":1}",
                     json -> json.inPath("test1").isEqualTo(2),
                     json -> json.inPath("test2").isEqualTo(1)
                 );
         
      • json

        @NotNull
        public static @NotNull Object json​(Object input)
        JSON to be used in expected part of the assertion,
        Parameters:
        input -
        Returns:
        Object suitable for comparison. Implementation type may change in the future.
      • value

        @NotNull
        public static @NotNull Object value​(Object input)
        Value passed here is not parsed as JSON but used as it is