+++ /dev/null
-package net.pterodactylus.sone.fcp;
-
-import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.ALWAYS;
-import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.NO;
-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;
-
-import org.junit.Test;
-
-/**
- * Unit test for {@link FcpInterface} and its subclasses.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
-public class FcpInterfaceTest {
-
- private final FcpInterface fcpInterface = new FcpInterface(null);
-
- @Test
- public void fcpInterfaceCanBeActivated() {
- fcpInterface.fcpInterfaceActivated(new FcpInterfaceActivatedEvent());
- assertThat(fcpInterface.isActive(), is(true));
- }
-
- @Test
- public void fcpInterfaceCanBeDeactivated() {
- fcpInterface.fcpInterfaceDeactivated(new FcpInterfaceDeactivatedEvent());
- assertThat(fcpInterface.isActive(), is(false));
- }
-
- private void setAndVerifyAccessRequired(FullAccessRequired fullAccessRequired) {
- fcpInterface.fullAccessRequiredChanged(new FullAccessRequiredChanged(fullAccessRequired));
- assertThat(fcpInterface.getFullAccessRequired(), is(fullAccessRequired));
- }
-
- @Test
- public void setFullAccessRequiredCanSetAccessToNo() {
- setAndVerifyAccessRequired(NO);
- }
-
- @Test
- public void setFullAccessRequiredCanSetAccessToWriting() {
- setAndVerifyAccessRequired(WRITING);
- }
-
- @Test
- public void setFullAccessRequiredCanSetAccessToAlways() {
- setAndVerifyAccessRequired(ALWAYS);
- }
-
-}
--- /dev/null
+package net.pterodactylus.sone.fcp
+
+import net.pterodactylus.sone.core.Core
+import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired
+import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.ALWAYS
+import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.NO
+import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING
+import net.pterodactylus.sone.fcp.event.FcpInterfaceActivatedEvent
+import net.pterodactylus.sone.fcp.event.FcpInterfaceDeactivatedEvent
+import net.pterodactylus.sone.fcp.event.FullAccessRequiredChanged
+import net.pterodactylus.sone.test.mock
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
+import org.junit.Test
+
+/**
+ * Unit test for [FcpInterface] and its subclasses.
+ */
+class FcpInterfaceTest {
+
+ private val core = mock<Core>()
+ private val fcpInterface = FcpInterface(core)
+
+ @Test
+ fun `fcp interface can be activated`() {
+ fcpInterface.fcpInterfaceActivated(FcpInterfaceActivatedEvent())
+ assertThat(fcpInterface.isActive, equalTo(true))
+ }
+
+ @Test
+ fun `fcp interface can be deactivated`() {
+ fcpInterface.fcpInterfaceDeactivated(FcpInterfaceDeactivatedEvent())
+ assertThat(fcpInterface.isActive, equalTo(false))
+ }
+
+ private fun setAndVerifyAccessRequired(fullAccessRequired: FullAccessRequired) {
+ fcpInterface.fullAccessRequiredChanged(FullAccessRequiredChanged(fullAccessRequired))
+ assertThat(fcpInterface.fullAccessRequired, equalTo(fullAccessRequired))
+ }
+
+ @Test
+ fun `set full access required can set access to no`() {
+ setAndVerifyAccessRequired(NO)
+ }
+
+ @Test
+ fun `set full access required can set access to writing`() {
+ setAndVerifyAccessRequired(WRITING)
+ }
+
+ @Test
+ fun `set full access required can set access to always`() {
+ setAndVerifyAccessRequired(ALWAYS)
+ }
+
+}