Skip to content
example using jackson and json object from json simple. The json has a complex json scenario.i.e. json within json which we handle using a POJO as well as JsonObject.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
src
target
.gitattributes
README.md
json_jackson.iml
pom.xml

README.md

Json Jackson - Json Simple -Junit 4 - Junit 5 - Java 8

A example using jackson and json object from json simple. The json has a complex json scenario.i.e. json within json which we handle using a POJO as well as JsonObject.

  • We have 2 methods of accessing the data -
  1. Direct file access.
  2. I have build an API endpoint to return the json via a GET, so that we have a more real world data point.

Junit 5 and SpringBoot do not work out of the box at the current versions.

Yep, its true.

If you try this, you will find your your @Autowired dependencies return a null pointer. This is because we lose context at runtime of our injection. To curb this, we need to extend our SpringBootTest to include some other dependencies.

The Cool stuff:

@RunWith -> JunitPlatform.class, to run test tags with @IncludeTags @ExcludeTags @SuiteDisplayName @Tag -> test tags @RepeatableTest @DisplayName

Java 8 Lambda

I use java 8 lambda on assertAll for junit-jupiter.

SpringBoot support:

Using spring to build the API is like super simple. Using SpringBoot Dependency Injection -> @AutoWired to pull through our business/data-layer.

Reachout at : https://www.linkedin.com/in/suveerp/

You can’t perform that action at this time.