From 1cab55e38c0908fca6c48150801a54e80b235cc8 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 5 Jul 2008 11:37:54 +0000 Subject: [PATCH] * removed test for removed class --- .../tuned/FunctionIteratorTest.java | 120 ------------------ 1 file changed, 120 deletions(-) delete mode 100644 test/net/sourceforge/tuned/FunctionIteratorTest.java diff --git a/test/net/sourceforge/tuned/FunctionIteratorTest.java b/test/net/sourceforge/tuned/FunctionIteratorTest.java deleted file mode 100644 index 45c5318a..00000000 --- a/test/net/sourceforge/tuned/FunctionIteratorTest.java +++ /dev/null @@ -1,120 +0,0 @@ - -package net.sourceforge.tuned; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -import net.sourceforge.tuned.FunctionIterator.Function; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - - -@RunWith(Parameterized.class) -public class FunctionIteratorTest { - - @Parameters - public static Collection createParameters() { - List data = new ArrayList(); - - data.add("http://filebot.sourceforge.net"); - data.add("http://javapuzzlers.com"); - data.add("http://www.google.com"); - data.add("Vanessa Mae - Classical Gas"); // invalid URI - - return TestUtil.asParameters(TestUtil.rotations(data).toArray()); - } - - private final List data; - - - public FunctionIteratorTest(List data) { - this.data = data; - } - - - @Test - public void skipNull() { - Iterator iterator = new FunctionIterator(data, new FilterFunction("filebot")); - - String result = iterator.next(); - - assertEquals("http://filebot.sourceforge.net", result); - } - - - @Test(expected = NoSuchElementException.class) - public void noMoreNext() { - Iterator iterator = new FunctionIterator(new ArrayList(), new UriFunction()); - - iterator.next(); - } - - - @Test(expected = IllegalArgumentException.class) - public void throwException() { - Iterator iterator = new FunctionIterator(data, new UriFunction()); - - while (iterator.hasNext()) { - iterator.next(); - } - } - - - @Test - public void iterate() { - Iterator iterator = new FunctionIterator(data, new UriFunction()); - - List values = new ArrayList(); - - while (iterator.hasNext()) { - try { - values.add(iterator.next()); - } catch (Exception e) { - - } - } - - assertTrue(values.size() == 3); - } - - - private static class UriFunction implements Function { - - @Override - public URI evaluate(String sourceValue) { - return URI.create(sourceValue); - } - } - - - private static class FilterFunction implements Function { - - private final String filter; - - - public FilterFunction(String filter) { - this.filter = filter; - } - - - @Override - public String evaluate(String sourceValue) { - if (sourceValue.contains(filter)) - return sourceValue; - - return null; - } - } - -}