Posts

Parameterized tests in JavaScript with Jest

Parameterized tests are used to test the same code under different conditions. One can set up a test method that retrieves data from a data source. This data source can be a collection of objects, external file or maybe even a database. The general idea is to make it easy to test different conditions with the same test method to avoid duplication and make the code easier to read and maintain. Jest has a built-in support for tests parameterized with data table that can be provided either by an array of arrays or as tagged template literal .

Testing promise rejection in JavaScript with Jest

Testing exceptions in JavaScript with Jest

Getting started with Github Actions: Run JUnit 5 tests in a Java project with Maven

Github Actions is a CI/CD service provided by Github and it is free for public repositories. For private repositories, each GitHub account receives a certain amount of free minutes and storage, depending on the product used with the account. In this blog post, you will learn how to create a simple workflow for running JUnit 5 tests in a Maven based Java project and how to add a build status badge to a README.md file.

macOS: Notes app tips that may improve your daily workflow

Image
After switching from Windows to macOS in 2019 I also changed my default note taking app from OneNote to macOS build-in Notes.app. I wasn’t sure this is the right move, so I switched gradually with carefully selected topics only. But after several weeks of using both OneNote and Notes app I switched fully and after using Notes for several months now I would like to share some of my tips I find useful in my daily workflow. Note: This blog post is focused on macOS version of the app as I use it most of the time.

Convert time unit to duration in Java

java.util.concurrent.TimeUnit represents time durations in Java at a given unit of granularity and provides utility methods to convert across units. java.util.concurrent.TimeUnit was introduced back in the old Java days (1.5) but since then it has been extended several times already. In this blog post you will learn how to use java.util.concurrent.TimeUnit to convert a given time unit to a duration .

Switch as an expression in Java with Lambda-like syntax

As of Java 14, the switch expression has an additional Lambda-like ( case ... -> labels ) syntax and it can be used not only as a statement, but also as an expression that evaluates to a single value.