From 83d39239e1d4c61ab14964e417c8d4fb189e80ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 30 Jul 2014 14:59:34 +0200 Subject: [PATCH] Increase test coverage. --- .../pterodactylus/sone/core/DefaultOptionTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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)); + } + } -- 2.7.4