From: David ‘Bombe’ Roden Date: Wed, 30 Jul 2014 12:59:34 +0000 (+0200) Subject: Increase test coverage. X-Git-Tag: 0.9-rc1^2~3^2~194 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=83d39239e1d4c61ab14964e417c8d4fb189e80ff;p=Sone.git Increase test coverage. --- diff --git a/src/test/java/net/pterodactylus/sone/core/DefaultOptionTest.java b/src/test/java/net/pterodactylus/sone/core/DefaultOptionTest.java index d7ca110..8a1f8d5 100644 --- a/src/test/java/net/pterodactylus/sone/core/DefaultOptionTest.java +++ b/src/test/java/net/pterodactylus/sone/core/DefaultOptionTest.java @@ -103,4 +103,23 @@ public class DefaultOptionTest { assertThat(defaultOption.validate(new Object()), is(false)); } + @Test + public void settingToNullWillRestoreDefaultValue() { + DefaultOption defaultOption = new DefaultOption(defaultValue); + defaultOption.set(null); + assertThat(defaultOption.get(), is(defaultValue)); + } + + @Test + public void validateWithoutValidatorWillValidateNull() { + DefaultOption defaultOption = new DefaultOption(defaultValue); + assertThat(defaultOption.validate(null), is(true)); + } + + @Test + public void validateWithValidatorWillValidateNull() { + DefaultOption defaultOption = new DefaultOption(defaultValue, matchesAcceptedValue); + assertThat(defaultOption.validate(null), is(true)); + } + }