Java 10 and Local-Variable Type Inference

Robert Rice Java, Technology Snapshot Leave a Comment

JDK 10, an implementation of Java Standard Edition, was released in March 2018. It brought with it Local-Variable Type Inference to help simplify the writing of Java applications.

Basically, it’s a new syntax meant to reduce some of Java’s verbosity, while still maintaining the enforcement of static type safety. In simpler terms, you are able to declare variables, but won’t necessarily have to specify the type.

In this blog, I give recommendations for best practice when using Local-Variable Type Inference in JDK 10 with an eye for common var pitfalls…



Reading and Writing from Excel in Spring Batch

Rik Scarborough Java, Spring, Spring Batch, Technology Snapshot, Tutorial Leave a Comment

We have discussed many different ways to read and write data in Spring Batch. The framework comes with quite an assortment of Readers and Writers that can be used directly or reused in some manner. Most of the time, the requirements consist of reading the data from some type of text file or database.

So what happens when the business we are supporting asks for something out of the ordinary, such as reading an Excel file and outputting the data to another Excel file? Typically the off-the-cuff response would be, “can you convert it to a CSV or other delimited text file?” Or “You know, Excel will read a CSV file just fine.” Sometimes that works, and sometimes the business requirements do not allow that type of flexibility.

Consider this scenario; in these days of Cloud and other online computing, the input file is likely created by a server that the company has no direct access to as far as programming. The file it creates is in one format, Excel. The output of your process has to go before several executives or other business clients and needs to be formatted in a professional looking manner. Adding a manual process to import a CSV and format it diminishes the value of using Spring Batch.

For the sake of the honor of the coding profession, you agree to the requirement to read and write from an Excel file directly. Now, how do you do that?…



What’s New in JUnit 5.2

Billy Korando Effective Automated Testing With Spring Series, Java, Technology Snapshot, Testing Leave a Comment

The JUnit team continues to make great progress in adding new features and enhancements to the JUnit 5 framework. We already have a second significant feature update after just seven months from the initial release of JUnit 5.

In this article, we look at some of the key features and enhancements added in JUnit 5.2 which was released on April 29th. We’ll focus on build tool enhancements that help in the adoption/migration to JUnit 5 for existing test suites and resolve annoyances, as well as what new changes further improve parameterized tests.



Blockchain Implementation With Java Code

David Pitt Blockchain, Java Leave a Comment

Bitcoin is hot — and what an understatement that is. While the future of cryptocurrency is somewhat uncertain, blockchain, the technology used to drive Bitcoin, is also very popular.

Blockchain has an almost endless application scope. It also, arguably, has the potential to disrupt enterprise automation. There is a lot of information available covering what and how blockchain works. We have a free whitepaper that goes into blockchain technology (no registration required).

This blog will focus on the blockchain architecture, particularly demonstrating how the “immutable, append-only” distributed ledger works with simplistic code examples.

As developers, seeing things in code can be much more useful in understanding how it works, than simply reading technical articles. At least that’s the case for me. Let’s get started.



Fluent Assertions with AssertJ

Billy Korando Effective Automated Testing With Spring Series, Java, Series Leave a Comment

I recently gave a presentation to my Keyhole team members about JUnit 5. I started off the presentation by covering the importance of automated testing, how lack of automated testing affects an organization’s ability to deliver code to production, and how without automated testing you are building legacy.

I pointed out two key benefits of automated testing: confidence you are fixing what you set out to fix, and confidence you are not introducing a new bug. A co-worker however pointed out an important third benefit of automated testing: providing living documentation.

My co-worker made the very good point that automated testing can do more than just checking for code correctness. It can also provide valuable documentation for current and future developers on a project.

In this article, we look at how using AssertJ can make automated tests easier to read and write. We take a look at how AssertJ improves the readability of assertions in test cases, as well as how it helps make the task of comparing complex objects and performing list validations easier to read and write. The goal is that when tests are easier to read and write, it will hopefully encourage developers to write more tests (i.e. documentation).