Move test Value implementation to top-level class.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Sep 2014 05:11:58 +0000 (07:11 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Sep 2014 05:11:58 +0000 (07:11 +0200)
src/test/java/net/pterodactylus/sone/TestValue.java [new file with mode: 0644]
src/test/java/net/pterodactylus/sone/core/ConfigurationSoneParserTest.java

diff --git a/src/test/java/net/pterodactylus/sone/TestValue.java b/src/test/java/net/pterodactylus/sone/TestValue.java
new file mode 100644 (file)
index 0000000..4f3058b
--- /dev/null
@@ -0,0 +1,37 @@
+package net.pterodactylus.sone;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import net.pterodactylus.util.config.ConfigurationException;
+import net.pterodactylus.util.config.Value;
+
+/**
+* Simple {@link Value} implementation.
+*
+* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+*/
+public class TestValue<T> implements Value<T> {
+
+       private final AtomicReference<T> value = new AtomicReference<T>();
+
+       public TestValue(T originalValue) {
+               value.set(originalValue);
+       }
+
+       @Override
+       public T getValue() throws ConfigurationException {
+               return value.get();
+       }
+
+       @Override
+       public T getValue(T defaultValue) {
+               final T realValue = value.get();
+               return (realValue != null) ? realValue : defaultValue;
+       }
+
+       @Override
+       public void setValue(T newValue) throws ConfigurationException {
+               value.set(newValue);
+       }
+
+}
index c8742c2..e30048b 100644 (file)
@@ -22,12 +22,12 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
 
 import net.pterodactylus.sone.TestAlbumBuilder;
 import net.pterodactylus.sone.TestImageBuilder;
 import net.pterodactylus.sone.TestPostBuilder;
 import net.pterodactylus.sone.TestPostReplyBuilder;
+import net.pterodactylus.sone.TestValue;
 import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidAlbumFound;
 import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidImageFound;
 import net.pterodactylus.sone.core.ConfigurationSoneParser.InvalidParentAlbumFound;
@@ -48,8 +48,6 @@ import net.pterodactylus.sone.database.PostBuilderFactory;
 import net.pterodactylus.sone.database.PostReplyBuilder;
 import net.pterodactylus.sone.database.PostReplyBuilderFactory;
 import net.pterodactylus.util.config.Configuration;
-import net.pterodactylus.util.config.ConfigurationException;
-import net.pterodactylus.util.config.Value;
 
 import com.google.common.base.Optional;
 import org.hamcrest.Matchers;
@@ -523,30 +521,4 @@ public class ConfigurationSoneParserTest {
                configurationSoneParser.parseImages(createImageBuilderFactory());
        }
 
-       private static class TestValue<T> implements Value<T> {
-
-               private final AtomicReference<T> value = new AtomicReference<T>();
-
-               public TestValue(T originalValue) {
-                       value.set(originalValue);
-               }
-
-               @Override
-               public T getValue() throws ConfigurationException {
-                       return value.get();
-               }
-
-               @Override
-               public T getValue(T defaultValue) {
-                       final T realValue = value.get();
-                       return (realValue != null) ? realValue : defaultValue;
-               }
-
-               @Override
-               public void setValue(T newValue) throws ConfigurationException {
-                       value.set(newValue);
-               }
-
-       }
-
 }