All posts by Dan Newton

I am a Computer Science graduate from the University of Leicester and currently working at Accenture as a Java Developer. Opinions and views found in my posts are my own and do not represent Accenture's views on any subject.

Simple Spring Boot: POST

A very quick and little tutorial into sending a POST request to a Rest Controller in Spring Boot. Have a look at Spring’s starter guide if your starting from scratch. The setup that is not described in this post is covered there. The Maven dependencies required in this post are The Rest Controller The first thing ...

Building with the Builder Pattern

If you have ever looked at a long constructor and got confused about the order that input values need to be added then I am here to help! The Builder Pattern helps expel this confusion as it removes the need for this long constructor and replaces it the a series of setters which make it clear ...

Testing Data Transfer Objects and Rest Controllers in Spring Boot

In this post I will cover some tests that can be run to ensure that your DTOs (Data Transfer Objects) are being serialized and deserialized correctly leading onto testing whether they are being passed to and returned from a Rest Controller without errors. Have a look at my previous posts, Passing Data Transfer Objects with GET ...

Returning Data Transfer Objects from a Rest Controller in Spring Boot

In this post I will cover returning a DTO (Data Transfer Object) from a Rest Controller in Spring Boot. Returning data from a REST call in a DTO is a tidy way of retrieving data from the server which otherwise would be returned as a List<Object>. Have a look at my previous post, Passing Data ...

Passing Data Transfer Objects with GET in Spring Boot

GET requests should be used to pass data to a Rest Controller when the state of the data is not being changed. This is a little tutorial on how to pass a DTO (data transfer object)  with GET requests in Spring Boot. Check out Spring's starter guide if your starting from scratch. The setup that ...

Writing your F.I.R.S.T unit tests

Unit tests are required to test singular sections of code. In java this would normally be a class. They provide confidence to programmers allowing changes to be made and by running tests throughout development any changes that break the tests can be reevaluated, whether that results in the production code being corrected or altering the test ...

Getting started with JUnitParams

Do you write enough tests? Even if the answer is yes there might be some scenarios where you could add a few more to cover extra possibilities. But do you really want to go through the effort of having to write out another test for the extra inputs you are going to test? JUnitParams provides a ...