1 package net.pterodactylus.sone.fcp;
3 import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.ALWAYS;
4 import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.NO;
5 import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING;
6 import static org.hamcrest.MatcherAssert.assertThat;
7 import static org.hamcrest.Matchers.is;
9 import net.pterodactylus.sone.fcp.event.FcpInterfaceActivatedEvent;
10 import net.pterodactylus.sone.fcp.event.FcpInterfaceDeactivatedEvent;
11 import net.pterodactylus.sone.fcp.event.FullAccessRequiredChanged;
13 import org.junit.Test;
16 * Unit test for {@link FcpInterface} and its subclasses.
18 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
20 public class FcpInterfaceTest {
22 private final FcpInterface fcpInterface = new FcpInterface(null);
25 public void fcpInterfaceCanBeActivated() {
26 fcpInterface.fcpInterfaceActivated(new FcpInterfaceActivatedEvent());
27 assertThat(fcpInterface.isActive(), is(true));
31 public void fcpInterfaceCanBeDeactivated() {
32 fcpInterface.fcpInterfaceDeactivated(new FcpInterfaceDeactivatedEvent());
33 assertThat(fcpInterface.isActive(), is(false));
37 public void setFullAccessRequiredCanSetAccessToNo() {
38 fcpInterface.fullAccessRequiredChanged(
39 new FullAccessRequiredChanged(NO));
40 assertThat(fcpInterface.getFullAccessRequired(), is(NO));
44 public void setFullAccessRequiredCanSetAccessToWriting() {
45 fcpInterface.fullAccessRequiredChanged(
46 new FullAccessRequiredChanged(WRITING));
47 assertThat(fcpInterface.getFullAccessRequired(), is(WRITING));
51 public void setFullAccessRequiredCanSetAccessToAlways() {
52 fcpInterface.fullAccessRequiredChanged(
53 new FullAccessRequiredChanged(ALWAYS));
54 assertThat(fcpInterface.getFullAccessRequired(), is(ALWAYS));