Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

 

Effective Java – Creating and Destroying Objects

Creating and Destroying Objects (Ch 2) This is a short summary of Joshua Blochs book Effective Java chapter 2. I have only included items that are relevant for myself. Static Factories (item 1) Some advantages of static factories vs constructors: Factory methods have names which add a description to the constructor They can return pre-constructed object instead of always returning ...

Read More »

Effective Java – Method Common to All Objects

Methods Common to All Objects (Ch 3) This is a short summary of Joshua Blochs book Effective Java chapter 3. I have only included items that are relevant for myself. The general equals() contract (item 8) The equals contract describes the equivalence relation as: x.equals(null) == false Reflexive – x.equals(x) == true Symmetric – if x.equals(y) == true then y.equals(x) ...

Read More »

Get Started with Spring Boot, OAuth 2.0, and Okta

spring-interview-questions-answers

Build faster with Okta’s authentication and user management API. Register today for the free forever Developer Edition! If you’re building a Spring Boot application, you’ll eventually need to add user authentication. You can do this with OAuth 2.0 (henceforth: OAuth). OAuth is a standard that applications can use to provide client applications with “secure delegated access”. It works over HTTP ...

Read More »

Voxxed Days – Athens 2017 – short review #vdathens

Yesterday I had the pleasure to attend the very first Voxxed Days Athens. As I have written 6 months ago while attending Voxxed Days Thesalloniki, this was the day I’ve waiting for too many years, a  proper conference, with top class speakers on the main IT hub of Greece, Athens. Once again, congrats to Patroklos Papapetrou and the team around Voxxed Athens, at ...

Read More »

Mocking Spring Security Context for Unit Testing

spring-interview-questions-answers

Today, while writing unit test case for one of the Java method which looks like below: public ApplicationUser getApplicationUser() { ApplicationUser applicationUser = (ApplicationUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); return applicationUser; } I want to mock Spring Security Context to get the Principal, to achieve the same I mocked each level of method calls as follows: import org.junit.Before; import org.junit.Rule; import org.junit.Test; import static org.mockito.Mockito.when; ...

Read More »

Boosting test performance with TestContainers

java-interview-questions-answers

In my previous post on testing, I described how to use TestContainers to provide realistic test environments for database tests. This comment revealed the downside: …as noted above, there always seems to be some drawback. In this case, the overhead of starting the Docker image and everything it contains will increase your overall build time. As a reminder, here’s the ...

Read More »

Kotlin and Android: JetBrains and Google Behind One Language

Google I/O 2017 had several major announcements, but one of the most interesting to me is “first-class support for Kotlin” on Android. The Kotlin blog post on this announcement discusses the benefits this brings to Kotlin users: In case you are concerned about other platforms that Kotlin supports (Kotlin/JVM for server and desktop, Kotlin/JS and Kotlin/Native), please be sure that ...

Read More »

Single Statement Unit Tests

Many articles and books have already been written about unit testing patterns and anti-patterns. I want to add one more recommendation which, I believe, can help us make our tests, and our production code, more object-oriented. Here it is: a test method must contain nothing but a single assert.             Look at this test method ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns