Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 6738f5e

Browse files
author
Alex Collins
committed
Closes #87 add test for null safe toString()
1 parent 3348c37 commit 6738f5e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/unit/docker/registry/web/RegistrySpec.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ class RegistrySpec extends Specification {
150150
registry.password == null
151151
}
152152

153+
void "test toString doesn't NPE on null password :)"() {
154+
when:
155+
def registry = Registry.fromUrl("http://admin@172.17.42.1:5000/v1/")
156+
registry.password = null
157+
then:
158+
"Registry{id=null, protocol='http', host='172.17.42.1', port=5000, apiVersion='v1', username='admin', password='null', repositoryService=null, version=null}"
159+
.equals(registry.toString())
160+
}
161+
153162
void "test toString doesn't contain password :)"() {
154163
when:
155164
def registryStr = Registry.fromUrl("http://admin:abc123@172.17.42.1:5000/v1/").toString()

0 commit comments

Comments
 (0)