Test Doubles and Mocking Concepts in Java
A test double stands in for a real dependency so a unit can be tested in isolation, quickly and predictably.
Notes related to the Java language.
100 notes tagged
A test double stands in for a real dependency so a unit can be tested in isolation, quickly and predictably.
A unit test runs a small piece of code with known input and asserts the result, automatically and repeatedly.
A transaction makes several statements succeed or fail together, and batching turns many round trips into one.
Concatenating input into SQL lets a caller rewrite your query. Bound parameters make that structurally impossible.
JDBC is the standard API for talking to a relational database from Java: a connection, a statement, and a result set.
Since Java 11 the platform includes a modern HTTP client with synchronous and asynchronous requests and HTTP/2 support.
Addresses, sockets and streams. Underneath every network library in Java is a socket carrying bytes.
What changed in each release since Java 8, which old habits it replaces, and what to reach for in new code today.
An immutable object cannot change after construction, which removes whole categories of bug at the cost of a little copying.
A sealed type names exactly which types may extend it, which lets the compiler check that a pattern switch covers every case.
Modules add a boundary above packages: a module declares what it needs and what it exposes, and everything else stays private.
A dynamic proxy implements an interface at runtime and routes every call through one handler, which is how cross cutting behaviour is added.