Remove @author tags
[Sone.git] / src / test / java / net / pterodactylus / sone / core / OptionsTest.java
1 package net.pterodactylus.sone.core;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5 import static org.hamcrest.Matchers.nullValue;
6 import static org.mockito.Mockito.mock;
7
8 import net.pterodactylus.sone.utils.Option;
9
10 import org.junit.Test;
11
12 /**
13  * Unit test for {@link Options}.
14  */
15 public class OptionsTest {
16
17         private final Options options = new Options();
18
19         @Test
20         public void booleanOptionIsAdded() {
21                 Option<Boolean> booleanOption = mock(Option.class);
22                 options.addBooleanOption("test", booleanOption);
23                 assertThat(options.getBooleanOption("test"), is(booleanOption));
24                 assertThat(options.getBooleanOption("not-test"), nullValue());
25         }
26
27         @Test
28         public void integerOptionIsAdded() {
29                 Option<Integer> integerOption = mock(Option.class);
30                 options.addIntegerOption("test", integerOption);
31                 assertThat(options.getIntegerOption("test"), is(integerOption));
32                 assertThat(options.getIntegerOption("not-test"), nullValue());
33         }
34
35         @Test
36         public void stringOptionIsAdded() {
37                 Option<String> stringOption = mock(Option.class);
38                 options.addStringOption("test", stringOption);
39                 assertThat(options.getStringOption("test"), is(stringOption));
40                 assertThat(options.getStringOption("not-test"), nullValue());
41         }
42
43         @Test
44         public void enumOptionIsAdded() {
45                 Option<TestEnum> enumOption = mock(Option.class);
46                 options.addEnumOption("test", enumOption);
47                 assertThat(options.<TestEnum>getEnumOption("test"), is(enumOption));
48                 assertThat(options.<TestEnum>getEnumOption("not-test"), nullValue());
49         }
50
51         private enum TestEnum {TEST, NOT_TEST}
52
53 }