Mocking void
methods with Mockito (1 mins read).
How to Mock a void
method with Mockito, for instance to throw an exception.
Mocking void
methods with Mockito (1 mins read).
How to Mock a void
method with Mockito, for instance to throw an exception.
Content Negotiation with Servlet Filter
in Spring (Boot) (3 mins read).
How to perform content-negotiation in a Servlet Filter
, to serve the correct representation of error to a consumer, based on the Accept
header.
Content Negotiation with ControllerAdvice
and ExceptionHandler
s in Spring (Boot) (5 mins read).
How to perform content-negotiation in a Spring ExceptionHandler
, to serve the correct representation of error to a consumer, based on the Accept
header.
Error Handling in (Spring) Servlet Filters (2 mins read).
How to return HTTP errors when a Java Servlet fails with Spring (Boot).
Announcing uuid
, a Java Library for UUID Validation (1 mins read).
Releasing a new library that can be used to validate UUIDs in Java.
Validating UUIDs with Regular Expressions in Java (1 mins read).
How to validate UUIDs and UUIDv4s in Java with a regex.
Auditing with Spring Boot Actuator (9 mins read).
How to use Spring Boot Actuator for your audit and business event logging needs.
Returning a Value, or a Default, From a Java Optional
(1 mins read).
How to replace imperative code with a functional style, when returning a default value for a Java Optional
.
Adding both an ObjectMapper
and a YAMLMapper
to Spring Boot (2 mins read).
How to have an ObjectMapper
and a YAMLMapper
coexisting in a Spring Boot project's bean dependencies.
Testing Data Serialisation/Deserialization in Java (with Gson) (3 mins read).
How to validate your JSON types correctly serialise/deserialise when using the Gson library.
Bill Gates: I'm literally losing sleep over Java September 30, 1996Internal Tech Emails (@TechEmails)Wed, 05 Jan 2022 17:50 GMT
Publishing to Maven Repositories with GitLab CI, with Signed Artefacts (4 mins read).
How to publish signed artefacts from a Gradle build to Maven repositories (such as Maven Central) when using GitLab CI.
Gotcha: PicoContainer requires Zero-Argument Constructors (2 mins read).
A little gotcha around using PicoContainer (with Cucumber) where it may not be usable unless you have zero-arg constructors.
Using Dagger for Dependency Injection with Cucumber Tests (4 mins read).
How and why to add Dagger for your Cucumber tests' dependency injection.
Decompiling Java Class Files On the Command-Line (2 mins read).
How to use the Fernflower decompiler on the command-line to decompile compiled Java classes.
Validating a Spring (Boot) Response Matches JSON Schema with MockMVC (3 mins read).
How to perform JSON Schema validation for a Spring (Boot) service's response when testing using MockMVC.
#Java17ASHISH CHOUDHARY π¨π»βπ»π§π»π¨βπ©βπ¦ (@iASHeeesh)Mon, 18 Oct 2021 11:38 +0000
Retrieving All Dependencies Required by a JAR at Runtime (3 mins read).
How to handily retrieve the full runtime classpath required for a JAR file, using Gradle.
It looks like you're looking for catchThrowableOfType
, which allows you to receive the correct class:
import static org.assertj.core.api.Assertions.catchThrowableOfType;
SomeException throwable = catchThrowableOfType(() -> service.doSomething(), SomeException.class);
assertThat(throwable.getSomething()).isNotNull();
I was today years old that I learned when you hash a URL in Java it does a DNS lookup to get the IP address associated with the hostname as part of the hash function.
Post details
If you're surprised about the log4j vulnerability, just wait until you hear what happens when you put a java.net.URL into a hashtablePete Hunt π (@floydophone)Sat, 11 Dec 2021 21:05 GMT
Nicholas Weaver (@ncweaver)Mon, 13 Dec 2021 17:58 GMT
Why I don't like Java for Lambda functions How it cold started How it keeps goingPaul Johnston - containing his snark (@PaulDJohnston)Tue, 14 Dec 2021 13:29 GMT
Getting the Date from a Week Number in Java (1 mins read).
How to get the date from a week number and year in Java.
Pretty much every day for the last 10 years.
Dio Rettori (@rettori)Sat, 11 Dec 2021 20:58 GMT
from @BlackHatEvents USA 2016: A Journey From #JNDI/LDAP Manipulation to Remote Code Execution Dream Land by @pwntester and @olekmirosh blackhat.com/docs/us-16/mat⦠now the exploit vector presented in 2016 is the #log4jRCE. attached slide #11 from the presentation below. :)an0n (@an0n_r0)Sat, 11 Dec 2021 12:23 GMT
Hey #Java Developers βοΈ It's your Monday #SipOfJava, rewind edition βͺ Want to experiment with a new feature in Java? Or just try something out? π§ͺπ¬ Consider writing a single file application and running it with the java launcher! Happy Coding!Billy Korando βοΈ βοΈππ#BLM (@BillyKorando)Mon, 06 Dec 2021 16:00 GMT
Reducing Risk of Supply Chain Attacks with Reproducible Builds in Gradle (1 mins read).
How to enable Gradle's reproducible builds functionality to allow others to verify your released libraries don't contain uncommitted, malicious code.
Packaging Wiremock Stubs into a Standalone JAR (2 mins read).
How to use Gradle to package a standalone JAR for Wiremock, including any stubs needed.
Testing Data Serialisation/Deserialization in Java (with Moshi) (3 mins read).
How to validate your JSON types correctly serialise/deserialise when using the Moshi library.
Generate Plain Old Java Objects (POJOs) from JSON Schema Definitions with Gradle (3 mins read).
How to generate POJOs really quickly and easily, with no manual work, using the Gradle jsonschema2pojo Plugin.
Shift Your Testing Left with Spring Boot Controllers (5 mins read).
How to break down your tests for Spring Boot controllers, which could be used when performing Test Driven Development.
Generate Plain Old Java Objects (POJOs) from XML Schema Definitions with Gradle (1 mins read).
How to generate POJOs really quickly and easily, with no manual work, using the Gradle XJC Plugin.
Determining the Version Of Libraries Packaged into the Java AWS Lambda Runtime (3 mins read).
How to determine what libraries, and their respective versions, are packaged into AWS Lambda.
Lessons Learned from Running Java in Serverless Environments like AWS Lambda (10 mins read).
Some recommendations for running Java as a Serverless application language, for instance on AWS Lambda or Google Cloud Functions.
Generating Dynamic Identifiers with Thymeleaf (1 mins read).
How to generate a dynamic id
s for elements in Thymeleaf.
An ex colleague of mine wrote this pretty great article about cold start reduction for Java https://www.capitalone.com/tech/cloud/aws-lambda-java-tutorial-reduce-cold-starts/
Running a Java WAR File on the Command-Line (2 mins read).
How to run a WAR file locally, using Jetty, without installing anything.
Creating More Descriptive and Fluent Assertion Helpers (4 mins read).
How to improve test readability, and developer experience, using assertion helpers.
Using JitPack to Install Gradle Plugins from Git Sources (2 mins read).
How to use JitPack to use an unreleased Gradle plugin from a Git repo in your Gradle projects.