Quantcast
Channel: hasCode.com
Browsing all 92 articles
Browse latest View live

Dependency Injection for Go with facebookgo-inject

Setting up a larger application using dependency injection always requires us developers to set up our application’s object graph. Programming in Go there is a library that eases this task for us,...

View Article


Handling System Properties, Environment Variables, STDOUT/STDERR in JUnit...

When important data is written to STDIN/STDOUT and an application relies on specific system properties or environment variables, writing tests is getting more complicated. System Rules is a collection...

View Article


Transforming JSON Structures with Java and JOLT

When it comes to web-services (especially RESTful web-services), configuration files or other data-descriptors, the JavaScript Object Notation, short: JSON is often used as format of choice. As the...

View Article

Resilient Architecture in Practice – Circuit Breakers for Java: Failsafe,...

When dealing with remote services or APIs there is always the risk of latency issues, failures or connection losses. The worst thing to happen is when the remote service is down and our application...

View Article

Snippet: Integrating the Drools Business Rules Management System in 5 Minutes

Drools is a slim Business Rules Management System (BRMS) solution with different integrations and tools available. In the following short snippet I’d like to demonstrate how to integrate a simple rule...

View Article


Writing BDD-Style Webservice Tests with Karate and Java

There is a new testing framework out there called Karate that is build on top of the popular Cucumber framework. Karate makes it easy to script interactions with out web-services under test and verify...

View Article

Snippet: Java 9 Modules and JPMS

Playing around with the new module system in Java 9 I simply wanted to write down how to achieve the most basic tasks. Therefore I created the following module how-to based upon a simple demonstration...

View Article

Distributed Authorization and Contextual Caveats for Java with Macaroons and...

Google’s Macaroons are a mechanism to establish distributed authorization. The distinction to the classical bearer-token is their ability that they may be used to perform an action under certain...

View Article


Template Driven Test POJO Generation with Fixture Factory and Java

In our tests we often need to create a bunch of test-objects that are populated with random-data. This data needs to follow specific rules as identifiers need to be unique or must be incremented,...

View Article


Assuring Architectural Rules with ArchUnit

Maintaining architecture rules and constraints for a specific software project or an application is not easy as textual documentation is easily forgotten after a while and hard to verify. ArchUnit is a...

View Article

Using JUnit 5 Parameterized Tests, Argument Sources and Converters

With JUnit 5 the possibilities to write parameterized tests have changed and improved a lot. The following short overview covers all new types of possible parameter sources for JUnit 5 tests as well as...

View Article

Downloading Maven Artifacts from a POM file programmatically with Eclipse Aether

Sometimes I need to resolve Maven dependencies programmatically. Eclipse Aether is a library for working with artifact repositories and I’ll be using it in the following example to read dependency...

View Article

Microbenchmarks with JMH / Java Microbenchmark Harness

Writing microbenchmarks for parts of our applications is not always easy – especially when the internals of the virtual machine, the just-in-time-compiler and such things are coming into effect. Java...

View Article


Detecting Vulnerable Dependencies with Maven and the OWASP Dependency Check...

On the one hand adding dependencies to a project is easy, on the other hand securing a project and checking for vulnerable dependencies is way harder. The OWASP dependency check plugin for Maven allows...

View Article

Snippet: Java Mission Control (JMC) and Flight Recorder (JFR)

The Java Mission Control and the Java Flight Recorder allow us to capture run-time information from our Java applications without much overhead and aggregate profiling information. I have written down...

View Article


Identity Management, One-Time-Passwords and Two-Factor-Auth with Spring Boot...

Communicating with  identity and access management systems is a common task for many web-applications exposing secured resources. Keycloak is an open source software that provides not also such...

View Article

Software Architecture Exploration and Validation with jqAssistant, Neo4j and...

I have written about other software system analyzing and validation tools before but today I would like to introduce a new tool named jqAssistant that supports software architects, developers and...

View Article


Reactive Streams – Java 9 Flow API, RxJava, Akka and Reactor Examples

Reactive Streams is an initiative trying to standardize asynchronous stream processing with non-blocking  back-pressure. With Java 9, new classes in the java.util.concurrent.flow package offer a...

View Article

Implementing, Testing and Running Procedures for Neo4j

A lot of features are already included in the Neo4j graph database system but sometimes we want to extends its capabilities and implement functions and procedures by ourselves that we may reuse. In the...

View Article

Setting up Kafka Brokers for Testing with Kafka-Unit

When writing test for applications that interact with Kafka brokers we often need to setup a decent environment including an instance of Kafka and ZooKeeper. Though Kafka ships with some classes for...

View Article
Browsing all 92 articles
Browse latest View live