Posts with tag: Java
Distributed system observability: Instrument Selenium tests with OpenTelemetry
Instrument Selenium tests with OpenTelemetry and be able to custom trace the tests themselves.
Distributed system observability: Instrument Spring Boot application with OpenTelemetry
Instrumenting a Spring Boot Java application with OpenTelemetry.
Distributed system observability: complete end-to-end example with OpenTracing, Jaeger, Prometheus, Grafana, Spring Boot, React and Selenium
Code examples and explanations on an end-to-end example showcasing a distributed system observability from the Selenium tests through React front end, all the way to the database calls of a Spring Boot application. Examples are implemented with the OpenTracing toolset and traces are saved in Jaeger. This example also shows a complete observability setup including tools like Grafana, Prometheus, Loki, and Promtail.
Java 8 features - Stream API advanced examples
This post explains Java 8 Stream API with very basic code examples.
Java 8 features - Stream API basic examples
This post explains Java 8 Stream API with very basic code examples.
Java 8 features - Stream API explained
Code examples of Java 8 Stream API showing useful use cases.
Java 8 features - Lambda expressions, Interface changes, Stream API, DateTime API
Short overview of the most interesting and useful Java 8 features.
Run Dropwizard Java application on Vagrant
How to run Dropwizard or any other Java application on Vagrant.
What is Vagrant and why to use it
Brief description on Vagrant and when and why to use it.
Install Java application as a Linux service
Code snippet how to start Java application as a Linux service.
Build a Dropwizard project with Gradle
Code examples how to create Dropwizard project with Gradle.
PowerMock examples and why better not to use them
In this post, I have summarised all PowerMock examples I've given so far. More important I will try to give some justification why I think necessity to use PowerMock is considered an indicator for a bad code design.
Mock new object creation with PowerMock
How to control what objects are being instantiated when using PowerMock.
Mock private method call with PowerMock
How to mock private method with PowerMock by using spy object.
Call private method with PowerMock
How to invoke a private method with PowerMock.
Soft assertions that do not fail JUnit test
Code examples how to use assertions that do not fail the unit test immediately.
Verify static method was called with PowerMock
How to verify that static method was called during a unit test with PowerMock.
Manage Microsoft Excel files in Java with Apache POI
Code examples how to manage Microsoft Excel documents with Apache POI Java library.
Manage and automatically select needed WebDriver in Java 8 Selenium project
Example code how to efficiently manage and automatically select needed local WebDriver using Java 8 method reference used as lambda expression.
Run Dropwizard application in Docker with templated configuration using environment variables
How to run Dropwizard application inside a Docker container with configuration template file which later gets replaced by environment variables.
Data driven testing with JUnit and Gradle
How to do data-driven testing with JUnit and Gradle.
Mutation testing for Java with PITest
Introduction to mutation testing and examples with PITest tool for Java.
Mock/Stub REST API with WireMock for better unit testing
Examples how to use WireMock to stub (mock also is possible as a term) REST API in order make better unit testing.
Create simple REST API client using Jersey
Code examples how to create REST API client using Jersey.
Amazon S3 file upload with cURL and Java code
Working Java code to upload a file to Amazon S3 bucket with cURL.
Mock static methods in JUnit with PowerMock example
Examples how to mock static methods in JUnit tests with PowerMock.
Data driven testing with JUnit parameterized tests
How to do data-driven testing with JUnit parameterized tests.
JSON format to register service with Eureka
What JSON data is needed to register service node with Eureka server.
Unmarshal/Convert JSON data to JAXBElement object
How to marshal and unmarshal JAXBElement to JSON with Jackson.
MD5, SHA-1, SHA-256 and SHA-512 speed performance
Speed performance comparison of MD5, SHA-1, SHA-256 and SHA-512 cryptographic hash functions in Java.
Implement secure API authentication over HTTP with Dropwizard
Reference implementation on suggested in "How to implement secure REST API authentication over HTTP" post authentication mechanism.
How to implement secure REST API authentication over HTTP
How to implement secure API authentication even over HTTP.
Assert Mockito mock method arguments if no equals() method implemented
How to assert mock method is called with the specific object as an argument in case no equals() method is implemented on argument object.
Mock JUnit tests with Mockito example
Why mocking is needed in unit testing and how to do it with Mockito.
Avoid multithreading problems in Java using ThreadLocal
What are common approaches to deal with multithreading problems in Java. What is ThreadLocal and how to use it.
JUnit methods execution sequence
Details with code samples on JUnit methods execution sequence.
Retry JUnit failed tests immediately
How to retry failed JUnit tests immediately and if a retry is OK then report test as passed.
Use JUnit rules to debug failed API tests
What are JUnit rules and how to use them to improve debugging of failed API tests.
Create Cucumber JVM custom formatter
How to implement custom formatter for Cucumber JVM.
Running Cucumber tests in parallel
Details with code samples how to run Cucumber JVM tests in parallel.
Introduction to Cucumber and BDD with examples
Code examples and introduction to Cucumber, a framework that runs automated tests written in behavior driven development (BDD) style.
IntelliJ IDEA toString templates for JSON output
Templates to be applied to IntelliJ IDEA for automatic generation of toString() method that outputs the object in JSON format.
IntelliJ IDEA keyboard combinations
Some very useful keyboard combinations when working with IntelliJ IDEA.
Performance testing with Gatling - record and playback
How to record a simulation with Gatling recorder and play it back.
Performance testing with Gatling
Tutorial how to use Gatling and do successful performance testing with it.
Code coverage with JaCoCo offline instrumentation with Maven
Tutorial how to do code coverage with offline instrumentation with JaCoCo and Maven.
Automated code coverage of unit tests with JaCoCo and Maven
Tutorial how to setup code coverage with JaCoCo on unit tests to be done on each Maven build.
Code coverage of manual or automated tests with JaCoCo
Tutorial how to do code coverage on automated or even manual functional tests with JaCoCo.
JPS alternative for Dropwizard - Servlet with Apache Velocity template engine
How to create a web application with Dropwizard with Servlet and Apache Velocity template engine since JSP is not supported.
Send SOAP request over HTTPS without valid certificates
How to send SOAP request over HTTPS in Java without generating and installing certificates. NB: This MUST not be used for production code!
REST performance problems with Dropwizard and Jersey JAXB provider
Dropwizard's performance highly degrades when using REST with XML caused by Jersey's Abstract JAXB provider. Solution is to inject your own JAXB provider.
Build a RESTful stub server with Dropwizard
How to make a RESTful server that can be used for stub during testing.
Get rid of Getters and Setters
Use Project Lombok to reduce the amount of code you have to write by automating Getters and Setters generation
FIX messages simulator
General thoughts how to test FIX messages with a FIX simulator.
What about code coverage
Code coverage is a measurement of what percentage of program source code is being executed by your tests. Code coverage is a nice to have, but in no case make code coverage ultimate goal!