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.
Material for readers past the basics.
81 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.
A thread moves through six states, and knowing which one it is in is the first step in diagnosing any hang.
A thread is an independent path of execution inside one process, and Java gives you several ways to start one.
Every unbuffered read is a system call. Buffering turns thousands of them into a handful, and it is the single largest I/O win available.
InputStream and OutputStream carry raw bytes; Reader and Writer carry characters. Choosing wrongly corrupts data.
Path names a location and Files performs the operations. Together they replaced the older File class for almost every purpose.