From: David ‘Bombe’ Roden Date: Fri, 22 Feb 2019 05:48:50 +0000 (+0100) Subject: Verify that no events are sent on invalid property change X-Git-Tag: v79^2~111 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c2c32dca6279ad6f9af68cf2cf4870d56e7c2ff9;p=Sone.git Verify that no events are sent on invalid property change --- diff --git a/src/test/java/net/pterodactylus/sone/core/PreferencesTest.java b/src/test/java/net/pterodactylus/sone/core/PreferencesTest.java index fdae222..7327abc 100644 --- a/src/test/java/net/pterodactylus/sone/core/PreferencesTest.java +++ b/src/test/java/net/pterodactylus/sone/core/PreferencesTest.java @@ -10,6 +10,7 @@ import static org.mockito.ArgumentCaptor.forClass; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import net.pterodactylus.sone.core.event.InsertionDelayChangedEvent; @@ -50,6 +51,16 @@ public class PreferencesTest { } @Test + public void noEventIsSentWhenInvalidInsertionDelayIsSet() { + try { + preferences.setInsertionDelay(-15); + } catch (IllegalArgumentException iae) { + /* ignore. */ + } + verify(eventBus, never()).post(any()); + } + + @Test public void preferencesReturnDefaultValueWhenInsertionDelayIsSetToNull() { preferences.setInsertionDelay(null); assertThat(preferences.getInsertionDelay(), is(60));