--- /dev/null
+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);
+ }
+
+}
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;
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;
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);
- }
-
- }
-
}