Use new method to create test values everywhere.
[Sone.git] / src / test / java / net / pterodactylus / sone / fcp / FcpInterfaceTest.java
1 package net.pterodactylus.sone.fcp;
2
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;
8
9 import net.pterodactylus.sone.fcp.event.FcpInterfaceActivatedEvent;
10 import net.pterodactylus.sone.fcp.event.FcpInterfaceDeactivatedEvent;
11 import net.pterodactylus.sone.fcp.event.FullAccessRequiredChanged;
12
13 import org.junit.Test;
14
15 /**
16  * Unit test for {@link FcpInterface} and its subclasses.
17  *
18  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
19  */
20 public class FcpInterfaceTest {
21
22         private final FcpInterface fcpInterface = new FcpInterface(null);
23
24         @Test
25         public void fcpInterfaceCanBeActivated() {
26                 fcpInterface.fcpInterfaceActivated(new FcpInterfaceActivatedEvent());
27                 assertThat(fcpInterface.isActive(), is(true));
28         }
29
30         @Test
31         public void fcpInterfaceCanBeDeactivated() {
32                 fcpInterface.fcpInterfaceDeactivated(new FcpInterfaceDeactivatedEvent());
33                 assertThat(fcpInterface.isActive(), is(false));
34         }
35
36         @Test
37         public void setFullAccessRequiredCanSetAccessToNo() {
38                 fcpInterface.fullAccessRequiredChanged(
39                                 new FullAccessRequiredChanged(NO));
40                 assertThat(fcpInterface.getFullAccessRequired(), is(NO));
41         }
42
43         @Test
44         public void setFullAccessRequiredCanSetAccessToWriting() {
45                 fcpInterface.fullAccessRequiredChanged(
46                                 new FullAccessRequiredChanged(WRITING));
47                 assertThat(fcpInterface.getFullAccessRequired(), is(WRITING));
48         }
49
50         @Test
51         public void setFullAccessRequiredCanSetAccessToAlways() {
52                 fcpInterface.fullAccessRequiredChanged(
53                                 new FullAccessRequiredChanged(ALWAYS));
54                 assertThat(fcpInterface.getFullAccessRequired(), is(ALWAYS));
55         }
56
57 }