Files
java-interview-lab/bookmyshow/output/07-pitfalls.txt
T

30 lines
1.7 KiB
Plaintext

Pitfalls: partial holds, foreign releases, bad input, double Pay
================================================================
1. Request [A1, A2, A3] while someone else holds A3
NaiveInventory result false A1 AVAILABLE v0 A2 AVAILABLE v0
PessimisticInventory result false A1 AVAILABLE v0 A2 AVAILABLE v0
OptimisticInventory result false A1 AVAILABLE v2 A2 AVAILABLE v2
(v0 means the seat was never touched; v2 means it was held and handed back during the attempt)
2. Someone who does not own the hold tries to release or confirm it
NaiveInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
PessimisticInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
OptimisticInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
3. A BOOKED seat is not released by release(), even by its owner
NaiveInventory C2 after owner's release: BOOKED, a new hold on it returns false
PessimisticInventory C2 after owner's release: BOOKED, a new hold on it returns false
OptimisticInventory C2 after owner's release: BOOKED, a new hold on it returns false
4. Bad input (identical for all three inventories)
duplicate seat ids: IllegalArgumentException: duplicate seat id in request: A1
unknown seat: IllegalArgumentException: unknown seat Z99 for show SH-1
no seats at all: IllegalArgumentException: no seats requested
unknown show: IllegalArgumentException: unknown show: SH-404
5. Pay pressed 50 times at once for the same booking
calls that confirmed: 1
calls refused with IllegalStateException: 49
times the card was charged: 1