Search

Karol Lotkowski

Good line of code is worth a thousand words

Tag

java

API endpoint in one minute with Dropwizard

Dropwizard is hot and ready to serve resources so it’s time to create the first HTTP API endpoint and make our app useful. In this post I will prepare endpoint which return random clean code rule.

Continue reading “API endpoint in one minute with Dropwizard”

Run Dropwizard with Gradle

In the previous Gradle series post we built Wrapper to execute Gradle tasks without installed version on your machine. It’s time to write some code and make our project useful. In this post Gradle will help us to start a web server.

To make it happened we need:

Continue reading “Run Dropwizard with Gradle”

JavaZone 2015 conference in Oslo

After the holiday break thanks to the WebOn company I had an opportunity to attend in JavaZone 2015 conference in centre of Oslo.
I will not write about details of the conference. All the information you can check on their cool website. I will focus on my personal impression after the conference.

Continue reading “JavaZone 2015 conference in Oslo”

Use @Deprecated Java class without compilation warning

The first rule of using deprecated classes is to do not use deprecated classes. If you have to use such class then double check how to avoid such situation and find newer implementation of deprecated class (most of the time the new alternative solution is provided). But if you really forced to use deprecated class (e.g. 3rd-party library) then during class compilation (compileJava and compileTestJava Gradle tasks) you will get below warning:

Note: <path_to_your_class_where_deprecated_class_is_used>.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I will show you few solutions how to disable this warning.

Continue reading “Use @Deprecated Java class without compilation warning”

How to test abstract class in Java?

It’s not a problem to test class for which you can create an instance and execute implemented methods. Little problem starts when you would like to test class without an instance of this class. My way to test abstract classes is to create instance of the class as a mock via Mockito and simulate the behaviour.

Continue reading “How to test abstract class in Java?”

Gradle Wrapper: build script in the box

To make project totally independent from the Gradle installation version and get all the benefits from the Gradle buildpath it is a good idea to generate Wrapper script and put it into the project.

This action will protect project developers before using different Gradle version on each development machine and make development environment setup easier for the new contributors.

Continue reading “Gradle Wrapper: build script in the box”

Setup Java project with Gradle

If you are searching a nice and easy to use tool to work with Java (or any other) project – Gradle was created for it. This is a perfect tool to execute standard operations, such as: compile source code, run tests and build application (jar file).

Continue reading “Setup Java project with Gradle”

Create a free website or blog at WordPress.com.

Up ↑