Software architecture
Feature isolation test
Test the use case with a fake port. Executed Java 21 fixture.
Formal Syntax & Structure
java syntaxjava
place(Reserve stock,int n)Working Example
Example Snippetjava
public class Main { interface Reserve { boolean reserve(int n); } static String place(Reserve stock,int n) { if (n <= 0) throw new IllegalArgumentException("quantity"); return stock.reserve(n) ? "ACCEPTED" : "REJECTED"; } public static void main(String[] args) { System.out.println(place(n -> true, 2)); System.out.println(place(n -> false, 2)); }}