Replace test for ConfigurationLoader with Kotlin version
[Sone.git] / src / test / java / net / pterodactylus / sone / test / TestValue.java
index 94ff3c6..454163e 100644 (file)
@@ -2,6 +2,9 @@ package net.pterodactylus.sone.test;
 
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import net.pterodactylus.util.config.ConfigurationException;
 import net.pterodactylus.util.config.Value;
 
@@ -16,23 +19,25 @@ public class TestValue<T> implements Value<T> {
 
        private final AtomicReference<T> value = new AtomicReference<T>();
 
-       public TestValue(T originalValue) {
+       public TestValue(@Nullable T originalValue) {
                value.set(originalValue);
        }
 
        @Override
+       @Nullable
        public T getValue() throws ConfigurationException {
                return value.get();
        }
 
        @Override
-       public T getValue(T defaultValue) {
+       @Nullable
+       public T getValue(@Nullable T defaultValue) {
                final T realValue = value.get();
                return (realValue != null) ? realValue : defaultValue;
        }
 
        @Override
-       public void setValue(T newValue) throws ConfigurationException {
+       public void setValue(@Nullable T newValue) throws ConfigurationException {
                value.set(newValue);
        }
 
@@ -48,11 +53,13 @@ public class TestValue<T> implements Value<T> {
        }
 
        @Override
+       @Nonnull
        public String toString() {
                return String.valueOf(value.get());
        }
 
-       public static <T> Value<T> from(T value) {
+       @Nonnull
+       public static <T> Value<T> from(@Nullable T value) {
                return new TestValue<T>(value);
        }