From 8b159f6c1ebc844c75842a6d6a735c16abc5d8e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 8 Jan 2017 01:34:15 +0100 Subject: [PATCH] Refactor FCP interface test slightly --- .../net/pterodactylus/sone/fcp/FcpInterfaceTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.java b/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.java index 2312907..d1c31ad 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/FcpInterfaceTest.java @@ -6,6 +6,7 @@ import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; import net.pterodactylus.sone.fcp.event.FcpInterfaceActivatedEvent; import net.pterodactylus.sone.fcp.event.FcpInterfaceDeactivatedEvent; import net.pterodactylus.sone.fcp.event.FullAccessRequiredChanged; @@ -33,25 +34,24 @@ public class FcpInterfaceTest { assertThat(fcpInterface.isActive(), is(false)); } + private void setAndVerifyAccessRequired(FullAccessRequired fullAccessRequired) { + fcpInterface.fullAccessRequiredChanged(new FullAccessRequiredChanged(fullAccessRequired)); + assertThat(fcpInterface.getFullAccessRequired(), is(fullAccessRequired)); + } + @Test public void setFullAccessRequiredCanSetAccessToNo() { - fcpInterface.fullAccessRequiredChanged( - new FullAccessRequiredChanged(NO)); - assertThat(fcpInterface.getFullAccessRequired(), is(NO)); + setAndVerifyAccessRequired(NO); } @Test public void setFullAccessRequiredCanSetAccessToWriting() { - fcpInterface.fullAccessRequiredChanged( - new FullAccessRequiredChanged(WRITING)); - assertThat(fcpInterface.getFullAccessRequired(), is(WRITING)); + setAndVerifyAccessRequired(WRITING); } @Test public void setFullAccessRequiredCanSetAccessToAlways() { - fcpInterface.fullAccessRequiredChanged( - new FullAccessRequiredChanged(ALWAYS)); - assertThat(fcpInterface.getFullAccessRequired(), is(ALWAYS)); + setAndVerifyAccessRequired(ALWAYS); } } -- 2.7.4