Integration tests with Maven

Implementing unit tests with maven is something ordinary and most of us are familiar with the project structure and where the unit tests reside. However Integration tests are a different case and most of times they have pretty different requirements. For example it is ok to have your unit tests operate on a h2 in memory database but when it ...

Read More »

Transactional exception handling in CDI

java-interview-questions-answers

In Java EE, exceptions that are raised during the execution of a transactional business method cause the transaction to rollback. However, this is only the case for system exceptions, that is, runtime exceptions, which are not declared in the method signature. For application exceptions, that is, checked exceptions, or any exception annotated with @ApplicationException, the transaction is not automatically rolled ...

Read More »

Write custom AssertJ assertions

AssertJ is an alternative matching library to the widely used Hamcrest matchers. For my own projects I in fact have changed to solely use AssertJ — I just find the fluid interfaces and extensibility quite appealing. You can write custom assertions as follows: Imagine a coffee with a strength and a drink type, such as Espresso or Latte. A custom CoffeeAssert validates ...

Read More »

Kotlin – Tuple type

It is very simple to write a Tuple type with the expressiveness of Kotlin. My objective expressed in tests is the following: 1. Be able to define a Tuple of up to 5 elements and be able to retrieve the elements using an index like placeholder, in a test expressed with 2 elements like this: val tup = Tuple("elem1", "elem2") assertThat(tup._1).isEqualTo("elem1") assertThat(tup._2).isEqualTo("elem2") ...

Read More »

Ethereum Hello World Example using solc and web3

I’ve been trying to find an Ethereum Hello World example and came across Thomas Conté’s excellent post that shows how to compile and deploy an Ethereum smart contract with solc and web3. In the latest version of web3 the API has changed to be based on promises so I decided to translate Thomas’ example. Let’s get started. Install npm libraries ...

Read More »

Top 10 JavaCodeGeeks posts for 2017

Hello fellow geeks! 2017 is coming to its end and the new year is just around the corner! This has been again an amazing year for Java and Java Code Geeks. Our community continues to grow and improve, offering top-notch programming content to developers all over the world. Thank you for your support on achieving this great milestone! Our insiders ...

Read More »

Choosing Java Cryptographic Algorithms Part 3 – Public/Private key asymmetric encryption

Abstract This is the 3rd of a three-part blog series covering Java cryptographic algorithms. The series covers how to implement the following: Hashing with SHA–512 Single-key symmetric encryption with AES–256 RSA–4096 This 3rd post details how to implement public/private key, asymmetric, RSA–4096 encryption. Let’s get started. Disclaimer This post is solely informative. Critically think before using any information presented. Learn ...

Read More »