Commit 32cba95
Make name lookup null-safe and add typed lookup overload
- TestcontainerRegistry.lookup(String): flip the equals direction so
callers passing null get a null result instead of an NPE on a
populated registry. The compared `containerDesc.name` is sourced from
Testcontainer.name(), which by annotation rules cannot be null.
- TestcontainerRegistry.lookup(String, Class<T>): typed overload that
casts the looked-up container to the requested type, throwing
IllegalArgumentException if the registered container is not assignable
to the requested type. Returns null if no container with the given
name is registered.
Tests cover the null-name path on a populated registry, the typed-lookup
happy path including a missing-name null return, and the type-mismatch
throw path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 725095f commit 32cba95
2 files changed
Lines changed: 54 additions & 1 deletion
File tree
- src
- main/java/org/arquillian/testcontainers
- test/java/org/arquillian/testcontainers
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
79 | 101 | | |
80 | 102 | | |
81 | 103 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
54 | 85 | | |
55 | 86 | | |
56 | 87 | | |
| |||
0 commit comments