From e60e9dddc14c2daf3bcc759145d26366bd547bfd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 20 Jul 2015 06:51:55 +0200 Subject: [PATCH] Remove unused class --- .../net/pterodactylus/sone/utils/Optionals.java | 32 ------------- .../pterodactylus/sone/utils/OptionalsTest.java | 52 ---------------------- 2 files changed, 84 deletions(-) delete mode 100644 src/main/java/net/pterodactylus/sone/utils/Optionals.java delete mode 100644 src/test/java/net/pterodactylus/sone/utils/OptionalsTest.java diff --git a/src/main/java/net/pterodactylus/sone/utils/Optionals.java b/src/main/java/net/pterodactylus/sone/utils/Optionals.java deleted file mode 100644 index 67132aa..0000000 --- a/src/main/java/net/pterodactylus/sone/utils/Optionals.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pterodactylus.sone.utils; - -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.base.Predicate; - -/** - * Helper methods for dealing with {@link Optional}s. - * - * @author David ‘Bombe’ Roden - */ -public class Optionals { - - public static Predicate> isPresent() { - return new Predicate>() { - @Override - public boolean apply(Optional input) { - return input.isPresent(); - } - }; - } - - public static Function, T> get() { - return new Function, T>() { - @Override - public T apply(Optional input) { - return input.get(); - } - }; - } - -} diff --git a/src/test/java/net/pterodactylus/sone/utils/OptionalsTest.java b/src/test/java/net/pterodactylus/sone/utils/OptionalsTest.java deleted file mode 100644 index 0f7dee3..0000000 --- a/src/test/java/net/pterodactylus/sone/utils/OptionalsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pterodactylus.sone.utils; - -import java.util.Arrays; -import java.util.List; - -import com.google.common.base.Optional; -import com.google.common.collect.FluentIterable; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Test; - -/** - * Unit test for {@link Optionals}. - * - * @author David ‘Bombe’ Roden - */ -public class OptionalsTest { - - private final Object object1 = new Object(); - private final Object object2 = new Object(); - private final Object object3 = new Object(); - - @Test - public void canCreateOptionals() { - new Optionals(); - } - - @Test - public void isPresentFiltersCorrectOptionals() { - List> optionals = Arrays.asList( - Optional.of(object1), Optional.absent(), - Optional.of(object2), Optional.absent(), - Optional.of(object3), Optional.absent() - ); - List> filteredOptionals = - FluentIterable.from(optionals).filter(Optionals.isPresent()).toList(); - MatcherAssert.assertThat(filteredOptionals, Matchers.contains( - Optional.of(object1), Optional.of(object2), Optional.of(object3))); - } - - @Test - public void getReturnsCorrectValues() { - List> optionals = Arrays.asList( - Optional.of(object1), - Optional.of(object2), - Optional.of(object3) - ); - List objects = FluentIterable.from(optionals).transform(Optionals.get()).toList(); - MatcherAssert.assertThat(objects, Matchers.contains(object1, object2, object3)); - } - -} -- 2.7.4