Edge Case Catalog
Edge Case Catalog
Use this catalog as a learner checklist after each lesson. The answer verifier automates these checks, but reading the cases first helps you understand what can go wrong.
Lesson 1: Pricing And OOP Rules
- Empty cart subtotal is
0. - Empty cart has no most-expensive item.
- Quantity matters: line total is unit price times quantity.
- Item count means sum of quantities, not number of cart lines.
- Discount
0preserves subtotal. - Discount
100returns zero. - Discount below
0is invalid. - Discount above
100is invalid. - Tax uses basis points, so
825means8.25%. - Tax rounds to the nearest cent.
- Shipping is free when subtotal equals the free-shipping threshold.
- Empty carts ship for
0. - Negative shipping threshold is invalid.
- Negative standard shipping price is invalid.
- Sorting by line total breaks ties by name.
- Duplicate item names merge quantities.
Lesson 2: Decorator Rules
- Prefix changes the message before delegation.
- Suffix changes the message before delegation.
- Message transform can trim, uppercase, redact, or normalize.
- Rate-limit note changes the result after delegation.
- Audit records the message at the point where the audit wrapper sits.
- Blocklist short-circuits and does not delegate.
- Truncation accepts max length
0. - Truncation rejects negative length.
- Counting records every send attempt that reaches the counting wrapper.
- Counting outside blocklist and counting inside blocklist produce different counts.
- Composition with an empty decorator list returns the base channel.
- Composition order determines which wrapper is outermost.
Lesson 3: Concurrency And Aggregation Rules
- Parallel word count must match sequential word count.
- Empty input returns an empty count map.
- Blank documents contribute no words.
- Punctuation separates tokens.
- Case differences normalize to lowercase.
threadshould not matchthreads.- Merge functions should not mutate input maps.
- Overlapping keys add counts.
- Top word on an empty map has no result.
- Top-N with limit
0returns an empty list. - Top-N with negative limit is invalid.
- Top-N ties break alphabetically.
- Stop words are case-insensitive.
- Ordered parallel document lengths preserve input order.
- Interrupted tasks should restore the interrupt flag before throwing.
Lesson 4: Image And Pixel Rules
- Clamp handles lower bound, upper bound, and equal bounds.
- Invalid clamp range is rejected.
- Gray values must be bytes in
0..255. - Inverting black returns white.
- Inverting white returns black.
- Threshold includes values equal to cutoff.
- Threshold rejects invalid cutoff values.
- Luma extracts packed red, green, and blue channels.
- Packed gray output is opaque ARGB.
- Normalization clamps below and above range.
- Normalization rejects
min >= max. - Blend accepts alpha
0and1. - Blend rejects alpha outside
0..1. - Sobel magnitude clamps high gradient values.
- Image sampling clamps outside coordinates to the nearest edge.
- Empty images are invalid.
- Ragged images are invalid.
mean3x3uses clamped boundary samples at corners.
Lesson 5: Java @ Annotation Rules
@Overrideis compiler-checked and should fail if the method does not override anything.@FunctionalInterfacechecks that exactly one abstract method exists.@Deprecatedcan exposesinceandforRemovalmetadata.@SuppressWarningsshould be scoped narrowly.@SafeVarargsbelongs only on safe final, static, or private varargs methods or constructors.@Retention(RUNTIME)is required for normal runtime reflection.@Retention(CLASS)is not normally visible through reflection.@Targetcontrols legal annotation placement.@Repeatableannotations should be read withgetAnnotationsByType.@Inheritedworks for class annotations, not method annotations.@Target(TYPE_USE)is read through annotated types, not ordinary parameter annotations.- Package annotations live in
package-info.java. - Record component annotations are read from
RecordComponent. - Type parameter annotations are read from
Class.getTypeParameters. - Decorator/interceptor annotations are metadata until a framework or runtime code interprets them.
- Getter/setter annotations such as Lombok-style
@Getterand@Setterrequire an annotation processor or framework to generate behavior; this repo models them as metadata only. - Source-only annotations such as local markers,
@Serial, and@Nativecan affect tools or compiler checks without being runtime behavior.
Lesson 6: Spring Boot Hello World Rules
- Missing
nameuses the configured default name. - Blank or whitespace-only
nameuses the configured default name. - Leading and trailing spaces are trimmed.
- Repeated internal whitespace collapses to a single space.
- Names longer than
tutorial.greeting.max-name-lengthare rejected. - Missing punctuation uses
!. - Blank punctuation uses
!. - Allowed punctuation is only
!,?, or.. - URL-encoded
?must be handled as punctuation, not as a query separator. - Unsupported punctuation returns HTTP 400 through
ApiExceptionHandler. GET /helloandPOST /hellouse the same service rules.- JSON record fields should be
message,name, andpunctuation. - Controller tests should verify both HTTP status and response body.
- The app should bind to
0.0.0.0:8080by default when served locally.