1 package net.pterodactylus.sone.core;
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;
8 import net.pterodactylus.sone.utils.Option;
10 import org.junit.Test;
13 * Unit test for {@link Options}.
15 public class OptionsTest {
17 private final Options options = new Options();
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());
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());
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());
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());
51 private enum TestEnum {TEST, NOT_TEST}