Просмотр исходного кода

junit: debug & ignore patterns

Ranides Atterwim 10 лет назад
Родитель
Сommit
30bd0ad8ce

+ 420 - 423
assira.junit/src/main/java/net/ranides/assira/junit/InterfaceSuite.java

@@ -1,423 +1,420 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import javax.annotation.Resource;
-import org.junit.Assert;
-import org.junit.Ignore;
-
-/**
- * Inspects inheritance tree of objects passed to {@link #run} method and invokes
- * all compatible testers registered by {#append} method. For example, if you
- * register testers annotated as compatible with {@code Map} & {@code SortedMap}, 
- * then method {@code run} will invoke both of them for {@code TreeMap}, but only
- * the first one for {@codee HashMap}.
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public class InterfaceSuite {
-	
-	private final SortedSet<MethodRunner> methods = new TreeSet<>();
-    
-    private final List<TesterWrapper> testers = new ArrayList<>();
-    
-    private final Set<String> ignored = new HashSet<>();
-    
-    private final PrintStream output;
-    
-    private boolean debug;
-
-    public InterfaceSuite(PrintStream output) {
-        this.output = output;
-    }
-    
-    public InterfaceSuite debug(boolean value) {
-        this.debug = value;
-        return this;
-    }
-    
-    public InterfaceSuite ignore(String method) {
-        this.ignored.add(method);
-        return this;
-    }
-	
-	public InterfaceSuite append(Object tester) {
-        testers.add(new TesterWrapper(tester));
-        for(Method m : tester.getClass().getMethods()) {
-            if(Modifier.isStatic(m.getModifiers()) ) {
-                continue;
-            }
-            if(1 != m.getParameterCount()) {
-                continue;
-            }
-            if(null != m.getAnnotation(Ignore.class)) {
-                continue;
-            }
-            if(null == m.getAnnotation(InterfaceTest.class)) {
-                continue;
-            }
-            if(!m.getReturnType().equals(void.class)) {
-                continue;
-            }
-            MethodRunner mr = runner(tester, m);
-            if(null != mr) {
-                methods.add(mr);
-            }
-        }
-		return this;
-	}
-    
-    public InterfaceSuite param(String name, Object value) {
-        testers.stream().forEach((t) -> {
-            t.param(name, value);
-        });
-        return this;
-    }
-    
-    public boolean run(Function<int[], ?> generator) {
-        return irun(new TGeneratorF(generator));
-    }
-    
-    public boolean run(Supplier<?> generator) {
-        return irun(new TGeneratorS(generator));
-    }
-    
-    private boolean irun(TGenerator generator) {
-        Class<?> type = generator.get().getClass();
-        Counter counter = new Counter();
-        List<String> failed = new ArrayList<>();
-        methods.stream().filter((m)->m.accept(type)).forEach((m)->{
-            try {
-                m.run(counter, generator);
-            } catch(Throwable cause) {
-                failed.add(m.label);
-                cause.printStackTrace(output);
-            }
-        });
-        ireset();
-        if(!failed.isEmpty()) {
-            output.println();
-            output.println("Failed interface tests: ");
-            for(String f : failed) {
-                output.print(f);
-            }
-            output.println();
-            Assert.fail("Failed interface tests: " + failed.size() + "/"+counter.value);
-        }
-		return true;
-	}
-    
-    private void ireset() {
-        debug = false;
-        ignored.clear();
-        for(TesterWrapper tester : testers) {
-            tester.resetParams();
-        }
-    }
-    
-    private MethodRunner runner(Object that, Method method) {
-        if( method.getParameterTypes()[0].equals(Supplier.class) ) {
-            return new SMethodRunner(that, method);
-        }
-        if( method.getParameterTypes()[0].equals(Function.class) ) {
-            return new SMethodRunner(that, method);
-        }
-        return new CMethodRunner(that, method);
-    }
-    
-    private class CMethodRunner extends MethodRunner {
-
-        public CMethodRunner(Object that, Method method) {
-            super(that, method);
-        }
-
-        @Override
-        protected void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-            method.invoke(that, argument.get());
-        }
-        
-    }
-    
-    private class SMethodRunner extends MethodRunner {
-
-        public SMethodRunner(Object that, Method method) {
-            super(that, method);
-        }
-
-        @Override
-        protected void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-            method.invoke(that, argument);
-        }
-        
-    }
-    
-    private abstract class MethodRunner implements Comparable<MethodRunner> {
-        
-        protected final String uid;
-        
-        protected final String nid;
-        
-        protected final Class<?> type;
-        
-        protected final Object that;
-        
-        protected final Method method;
-        
-        protected String label;
-
-        public MethodRunner(Object that, Method method) {
-            this.type = typeof(method);
-            this.that = that;
-            this.method = method;
-            this.uid = type.getName()+"#"+method.getDeclaringClass().getName() +"#" + method.getName();
-            this.nid = method.getDeclaringClass().getSimpleName() + "." + method.getName();
-        }
-
-        @Override
-        public int compareTo(MethodRunner object) {
-            return uid.compareTo(object.uid);
-        }
-        
-        public boolean accept(Class<?> param) {
-            return type.isAssignableFrom(param);
-        }
-        
-        protected abstract void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
-        
-        public void run(Counter counter, TGenerator param) throws RuntimeException {
-            if( ignored.contains(nid) ) {
-                printf(type, counter.next(), method, "IGNORED");
-                return;
-            }
-            try {
-                invoke(param);
-                printf(type, counter.next(), method, "");
-            } catch (IllegalAccessException | IllegalArgumentException ex) {
-                throw NewAssert.rethrow(ex);
-            } catch (InvocationTargetException ex) {
-                if(ex.getTargetException() instanceof UnsupportedOperationException) {
-                    UnsupportedOperationException uoe = (UnsupportedOperationException)ex.getTargetException();
-                    
-                    if( "NO TEST".equals(uoe.getMessage())) {
-                        printf(type, counter.next(), method, "UNSUPPORTED");
-                        if(debug) {
-                            ex.printStackTrace(output);
-                        }
-                    } else {
-                        printf(type, counter.next(), method, "FAILED");
-                        throw NewAssert.rethrow(ex.getTargetException());
-                    }
-                    
-                } else {
-                    printf(type, counter.next(), method, "FAILED");
-                    throw NewAssert.rethrow(ex.getTargetException());
-                }
-            }
-        }
-        
-        private void printf(Class<?> type, int index, Method method, String comment) {
-            if(null == comment || comment.isEmpty()) {
-                comment = "";
-            } else {
-                comment = " - " + comment;
-            }
-            label = String.format(" - SUITE: %s [%d] %s.%s%s%n",
-                type.getName(),
-                index,
-                method.getDeclaringClass().getSimpleName(),
-                method.getName(),
-                comment
-            );
-            output.print(label);
-        }
-        
-    }
-    
-    static Class<?> typeof(Method method) {
-        Class<?> cparam = method.getParameterTypes()[0];
-        if(Supplier.class.isAssignableFrom(cparam)) {
-            return typeofSupplier(method);
-        }
-        if(Function.class.isAssignableFrom(cparam)) {
-            return typeofFunction(method);
-        }
-        return cparam;
-    }
-
-    private static Class<?> typeofSupplier(Method method) throws AssertionError {
-        ParameterizedType gparam = (ParameterizedType)method.getGenericParameterTypes()[0];
-        Type tparam = gparam.getActualTypeArguments()[0];
-        if(tparam instanceof Class<?>) {
-            return (Class<?>)tparam;
-        }
-        if(tparam instanceof ParameterizedType) {
-            return (Class<?>)(((ParameterizedType)tparam).getRawType());
-        }
-        throw new AssertionError("You can't use wildcard generic types in method: " + method, causeForMethod(method));
-    }
-    
-    private static Class<?> typeofFunction(Method method) throws AssertionError {
-        ParameterizedType gparam = (ParameterizedType)method.getGenericParameterTypes()[0];
-        if(!gparam.getActualTypeArguments()[0].equals(int[].class)) {
-            throw new AssertionError("Function must accept int[] in method: " + method, causeForMethod(method));
-        }
-        Type tparam = gparam.getActualTypeArguments()[1];
-        if(tparam instanceof Class<?>) {
-            return (Class<?>)tparam;
-        }
-        if(tparam instanceof ParameterizedType) {
-            return (Class<?>)(((ParameterizedType)tparam).getRawType());
-        }
-        throw new AssertionError("You can't use wildcard generic types in method: " + method, causeForMethod(method));
-    }
-
-    private static Exception causeForMethod(Method method) {
-        Exception e = new Exception("Invalid declaration");
-        e.setStackTrace(new StackTraceElement[]{
-            new StackTraceElement(
-                method.getDeclaringClass().getName(),
-                method.getName(), "?", -1)
-        });
-        return e;
-    }
-   
-    private static final class Counter {
-        private int value = 0;
-        
-        public int next() {
-            return ++value;
-        }
-    }
-    
-    private static final class TesterWrapper {
-        
-        private final Object object;
-        private final Map<String, IParam> resources = new HashMap<>();
-
-        public TesterWrapper(Object object) {
-            this.object = object;
-            for(Class<?> c=object.getClass(); c!=null; c=c.getSuperclass()) {
-                for(Field f : c.getDeclaredFields()) {
-                    Resource info = f.getAnnotation(Resource.class);
-                    if(null != info) {
-                        String name = info.name();
-                        if("".equals(name)) {
-                            name = f.getName();
-                        }
-                        f.setAccessible(true);
-                        resources.put(name, new IParam(object, f));
-                    }
-                }
-            }
-        }
-        
-        public void param(String name, Object value) {
-            if( resources.containsKey(name) ) {
-                resources.get(name).set(value);
-            }
-        }
-        
-        public void resetParams() {
-            for(IParam param : resources.values()) {
-                param.reset();
-            }
-        }
-        
-    }
-    
-    private interface TGenerator extends Function<int[], Object>, Supplier<Object>  { }
-    
-    private static class TGeneratorF implements TGenerator {
-        
-        private final Function<int[], ?> function;
-
-        public TGeneratorF(Function<int[], ?> function) {
-            this.function = function;
-        }
-
-        @Override
-        public Object get() {
-            return function.apply(new int[0]);
-        }
-
-        @Override
-        public Object apply(int[] t) {
-            return function.apply(t);
-        }
-        
-    }
-    
-    private static class TGeneratorS implements TGenerator {
-        
-        private final Supplier<?> function;
-
-        public TGeneratorS(Supplier<?> function) {
-            this.function = function;
-        }
-
-        @Override
-        public Object get() {
-            return function.get();
-        }
-
-        @Override
-        public Object apply(int[] t) {
-            throw new UnsupportedOperationException("Generator function not supplied.");
-        }
-        
-    }
-    
-    private static final class IParam {
-        private final Object object;
-        private final Field field;
-        private final Object value;
-
-        public IParam(Object object, Field field) {
-            try {
-                this.object = object;
-                this.field = field;
-                this.value = field.get(object);
-            } catch(ReflectiveOperationException cause) {
-                throw NewAssert.rethrow(cause);
-            }
-        }
-
-        public void set(Object value) {
-            try {
-                field.set(object, value);
-            } catch(ReflectiveOperationException cause) {
-                throw NewAssert.rethrow(cause);
-            }
-        }
-        
-        public void reset() {
-            try {
-                field.set(object, value);
-            } catch(ReflectiveOperationException cause) {
-                throw NewAssert.rethrow(cause);
-            }
-        }
-        
-    }
-	
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/assira.junit
+ */
+package net.ranides.assira.junit;
+
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import java.util.regex.Pattern;
+import javax.annotation.Resource;
+import org.junit.Assert;
+import org.junit.Ignore;
+
+/**
+ * Inspects inheritance tree of objects passed to {@link #run} method and invokes
+ * all compatible testers registered by {#append} method. For example, if you
+ * register testers annotated as compatible with {@code Map} & {@code SortedMap}, 
+ * then method {@code run} will invoke both of them for {@code TreeMap}, but only
+ * the first one for {@codee HashMap}.
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public class InterfaceSuite {
+	
+	private final SortedSet<MethodRunner> methods = new TreeSet<>();
+    
+    private final List<TesterWrapper> testers = new ArrayList<>();
+    
+    private final List<Pattern> ignored = new ArrayList<>();
+    
+    private final PrintStream output;
+    
+    private static final boolean DEBUG = "true".equals(System.getProperty("assira.junit.debug"));
+	
+    private boolean debug = DEBUG;
+
+    public InterfaceSuite(PrintStream output) {
+        this.output = output;
+    }
+    
+	public InterfaceSuite debug(boolean value) {
+        this.debug = value;
+		return this;
+	}
+	
+    public InterfaceSuite ignore(String method) {
+        this.ignored.add(Pattern.compile(Pattern.quote(method)));
+        return this;
+    }
+	
+	public InterfaceSuite ignore(Pattern method) {
+        this.ignored.add(method);
+        return this;
+    }
+	
+	public InterfaceSuite append(Object tester) {
+        testers.add(new TesterWrapper(tester));
+        for(Method m : tester.getClass().getMethods()) {
+            if(Modifier.isStatic(m.getModifiers()) ) {
+                continue;
+            }
+            if(1 != m.getParameterCount()) {
+                continue;
+            }
+            if(null != m.getAnnotation(Ignore.class)) {
+                continue;
+            }
+            if(null == m.getAnnotation(InterfaceTest.class)) {
+                continue;
+            }
+            if(!m.getReturnType().equals(void.class)) {
+                continue;
+            }
+            MethodRunner mr = runner(tester, m);
+            if(null != mr) {
+                methods.add(mr);
+            }
+        }
+		return this;
+	}
+    
+    public InterfaceSuite param(String name, Object value) {
+        testers.stream().forEach((t) -> {
+            t.param(name, value);
+        });
+        return this;
+    }
+    
+    public boolean run(Function<int[], ?> generator) {
+        return irun(new TGeneratorF(generator));
+    }
+    
+    public boolean run(Supplier<?> generator) {
+        return irun(new TGeneratorS(generator));
+    }
+    
+    private boolean irun(TGenerator generator) {
+        Class<?> type = generator.get().getClass();
+        Counter counter = new Counter();
+        List<String> failed = new ArrayList<>();
+        methods.stream().filter((m)->m.accept(type)).forEach((m)->{
+            try {
+                m.run(counter, generator);
+            } catch(Throwable cause) {
+                failed.add(m.label);
+                cause.printStackTrace(output);
+            }
+        });
+        ireset();
+        if(!failed.isEmpty()) {
+            output.println();
+            output.println("Failed interface tests: ");
+            for(String f : failed) {
+                output.print(f);
+            }
+            output.println();
+            Assert.fail("Failed interface tests: " + failed.size() + "/"+counter.value);
+        }
+		return true;
+	}
+    
+    private void ireset() {
+		debug = DEBUG;
+        ignored.clear();
+        for(TesterWrapper tester : testers) {
+            tester.resetParams();
+        }
+    }
+    
+    private MethodRunner runner(Object that, Method method) {
+        if( method.getParameterTypes()[0].equals(Supplier.class) ) {
+            return new SMethodRunner(that, method);
+        }
+        if( method.getParameterTypes()[0].equals(Function.class) ) {
+            return new SMethodRunner(that, method);
+        }
+        return new CMethodRunner(that, method);
+    }
+    
+    private class CMethodRunner extends MethodRunner {
+
+        public CMethodRunner(Object that, Method method) {
+            super(that, method);
+        }
+
+        @Override
+        protected void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+            method.invoke(that, argument.get());
+        }
+        
+    }
+    
+    private class SMethodRunner extends MethodRunner {
+
+        public SMethodRunner(Object that, Method method) {
+            super(that, method);
+        }
+
+        @Override
+        protected void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+            method.invoke(that, argument);
+        }
+        
+    }
+    
+    private abstract class MethodRunner implements Comparable<MethodRunner> {
+        
+        protected final String uid;
+        
+        protected final String nid;
+        
+        protected final Class<?> type;
+        
+        protected final Object that;
+        
+        protected final Method method;
+        
+        protected String label;
+
+        public MethodRunner(Object that, Method method) {
+            this.type = typeof(method);
+            this.that = that;
+            this.method = method;
+            this.uid = type.getName()+"#"+method.getDeclaringClass().getName() +"#" + method.getName();
+            this.nid = method.getDeclaringClass().getSimpleName() + "." + method.getName();
+        }
+
+        @Override
+        public int compareTo(MethodRunner object) {
+            return uid.compareTo(object.uid);
+        }
+        
+        public boolean accept(Class<?> param) {
+            return type.isAssignableFrom(param);
+        }
+        
+        protected abstract void invoke(TGenerator argument) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
+        
+        public void run(Counter counter, TGenerator param) throws RuntimeException {
+			for(Pattern p : ignored) {
+				if(p.matcher(nid).matches()) {
+					if(debug) {
+						printf(type, counter.next(), method, "IGNORED");
+					}
+					return;
+				}
+			}
+            try {
+                invoke(param);
+				if(debug) {
+					printf(type, counter.next(), method, "");
+				}
+            } catch (IllegalAccessException | IllegalArgumentException ex) {
+                throw NewAssert.rethrow(ex);
+            } catch (InvocationTargetException ex) {
+				printf(type, counter.next(), method, "FAILED");
+				throw NewAssert.rethrow(ex.getTargetException());
+            }
+        }
+        
+        private void printf(Class<?> type, int index, Method method, String comment) {
+            if(null == comment || comment.isEmpty()) {
+                comment = "";
+            } else {
+                comment = " - " + comment;
+            }
+            label = String.format(" - SUITE: %s [%d] %s.%s%s%n",
+                type.getName(),
+                index,
+                method.getDeclaringClass().getSimpleName(),
+                method.getName(),
+                comment
+            );
+            output.print(label);
+        }
+        
+    }
+    
+    static Class<?> typeof(Method method) {
+        Class<?> cparam = method.getParameterTypes()[0];
+        if(Supplier.class.isAssignableFrom(cparam)) {
+            return typeofSupplier(method);
+        }
+        if(Function.class.isAssignableFrom(cparam)) {
+            return typeofFunction(method);
+        }
+        return cparam;
+    }
+
+    private static Class<?> typeofSupplier(Method method) throws AssertionError {
+        ParameterizedType gparam = (ParameterizedType)method.getGenericParameterTypes()[0];
+        Type tparam = gparam.getActualTypeArguments()[0];
+        if(tparam instanceof Class<?>) {
+            return (Class<?>)tparam;
+        }
+        if(tparam instanceof ParameterizedType) {
+            return (Class<?>)(((ParameterizedType)tparam).getRawType());
+        }
+        throw new AssertionError("You can't use wildcard generic types in method: " + method, causeForMethod(method));
+    }
+    
+    private static Class<?> typeofFunction(Method method) throws AssertionError {
+        ParameterizedType gparam = (ParameterizedType)method.getGenericParameterTypes()[0];
+        if(!gparam.getActualTypeArguments()[0].equals(int[].class)) {
+            throw new AssertionError("Function must accept int[] in method: " + method, causeForMethod(method));
+        }
+        Type tparam = gparam.getActualTypeArguments()[1];
+        if(tparam instanceof Class<?>) {
+            return (Class<?>)tparam;
+        }
+        if(tparam instanceof ParameterizedType) {
+            return (Class<?>)(((ParameterizedType)tparam).getRawType());
+        }
+        throw new AssertionError("You can't use wildcard generic types in method: " + method, causeForMethod(method));
+    }
+
+    private static Exception causeForMethod(Method method) {
+        Exception e = new Exception("Invalid declaration");
+        e.setStackTrace(new StackTraceElement[]{
+            new StackTraceElement(
+                method.getDeclaringClass().getName(),
+                method.getName(), "?", -1)
+        });
+        return e;
+    }
+   
+    private static final class Counter {
+        private int value = 0;
+        
+        public int next() {
+            return ++value;
+        }
+    }
+    
+    private static final class TesterWrapper {
+        
+        private final Object object;
+        private final Map<String, IParam> resources = new HashMap<>();
+
+        public TesterWrapper(Object object) {
+            this.object = object;
+            for(Class<?> c=object.getClass(); c!=null; c=c.getSuperclass()) {
+                for(Field f : c.getDeclaredFields()) {
+                    Resource info = f.getAnnotation(Resource.class);
+                    if(null != info) {
+                        String name = info.name();
+                        if("".equals(name)) {
+                            name = f.getName();
+                        }
+                        f.setAccessible(true);
+                        resources.put(name, new IParam(object, f));
+                    }
+                }
+            }
+        }
+        
+        public void param(String name, Object value) {
+            if( resources.containsKey(name) ) {
+                resources.get(name).set(value);
+            }
+        }
+        
+        public void resetParams() {
+            for(IParam param : resources.values()) {
+                param.reset();
+            }
+        }
+        
+    }
+    
+    private interface TGenerator extends Function<int[], Object>, Supplier<Object>  { }
+    
+    private static class TGeneratorF implements TGenerator {
+        
+        private final Function<int[], ?> function;
+
+        public TGeneratorF(Function<int[], ?> function) {
+            this.function = function;
+        }
+
+        @Override
+        public Object get() {
+            return function.apply(new int[0]);
+        }
+
+        @Override
+        public Object apply(int[] t) {
+            return function.apply(t);
+        }
+        
+    }
+    
+    private static class TGeneratorS implements TGenerator {
+        
+        private final Supplier<?> function;
+
+        public TGeneratorS(Supplier<?> function) {
+            this.function = function;
+        }
+
+        @Override
+        public Object get() {
+            return function.get();
+        }
+
+        @Override
+        public Object apply(int[] t) {
+            throw new UnsupportedOperationException("Generator function not supplied.");
+        }
+        
+    }
+    
+    private static final class IParam {
+        private final Object object;
+        private final Field field;
+        private final Object value;
+
+        public IParam(Object object, Field field) {
+            try {
+                this.object = object;
+                this.field = field;
+                this.value = field.get(object);
+            } catch(ReflectiveOperationException cause) {
+                throw NewAssert.rethrow(cause);
+            }
+        }
+
+        public void set(Object value) {
+            try {
+                field.set(object, value);
+            } catch(ReflectiveOperationException cause) {
+                throw NewAssert.rethrow(cause);
+            }
+        }
+        
+        public void reset() {
+            try {
+                field.set(object, value);
+            } catch(ReflectiveOperationException cause) {
+                throw NewAssert.rethrow(cause);
+            }
+        }
+        
+    }
+	
+}

+ 163 - 158
assira.junit/src/main/java/net/ranides/assira/junit/NewAssert.java

@@ -1,158 +1,163 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public final class NewAssert extends org.junit.Assert {
-    
-    private NewAssert() { }
-    
-    public static void assertThrows(Class<? extends Throwable> error, Action action) {
-        try {
-            action.run();
-            fail(error + " expected");
-        } catch(Throwable cause) { // NOPMD
-            if( !error.isInstance(cause)) {
-                throw rethrow(cause);
-            }
-        }
-    }
-    
-    public static void assertSerializable(Object value) {
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        try (ObjectOutputStream ostream = new ObjectOutputStream(buffer)) {
-            ostream.writeObject(value);
-            
-            InputStream idata = new ByteArrayInputStream(buffer.toByteArray());
-            try (ObjectInputStream istream = new ObjectInputStream(idata)) {
-                assertEquals(value, istream.readObject());
-            }
-        } catch(IOException | ClassNotFoundException cause) {
-            throw rethrow(cause);
-        }
-    }
-    
-    /**
-     * Requirements (object : hash / pseudo-value)
-     * <pre>
-     *  A : 1 / 1
-     *  B : 1 / 1
-     *  C : 1 / 2
-     *  D : 2 / 3
-     * </pre>
-     * @param a1
-     * @param a2
-     * @param b
-     * @param c 
-     */
-    @SuppressWarnings("PMD.ShortVar")
-    public static void assertEquality(Object a, Object b, Object c, Object d) {
-        int ha = a.hashCode();
-        int hb = b.hashCode();
-        int hc = c.hashCode();
-        int hd = d.hashCode();
-        
-        assertTrue("hashcode: a==b", ha == hb);
-        assertTrue("hashcode: a==c", ha == hc);
-        assertTrue("hashcode: a!=d", ha != hd);
-        
-        assertTrue("a==a", a.equals(a));
-        assertTrue("b==b", b.equals(b));
-        assertTrue("c==c", c.equals(c));
-        assertTrue("d==d", d.equals(d));
-        
-        assertSymEquals("a == b", a,b);
-        
-        assertSymNotEquals("a != c", a,c);
-        assertSymNotEquals("a != d", a,d);
-        assertSymNotEquals("b != c", b,c);
-        assertSymNotEquals("b != d", b,d);
-        assertSymNotEquals("c != d", c,d);
-        
-        assertFalse("a != object", a.equals(new Object()));
-        assertFalse("b != object", b.equals(new Object()));
-        assertFalse("c != object", c.equals(new Object()));
-        assertFalse("d != object", d.equals(new Object()));
-    }
-    
-    /**
-     * Requirements (object : hash / pseudo-value)
-     * <pre>
-     *  A : 1 / 1
-     *  B : 1 / 1
-     *  D : 2 / 2
-     * </pre>
-     * @param a1
-     * @param a2
-     * @param b
-     * @param c 
-     */
-    @SuppressWarnings("PMD.ShortVar")
-    public static void assertEquality(Object a, Object b, Object d) {
-        int ha = a.hashCode();
-        int hb = b.hashCode();
-        int hd = d.hashCode();
-        
-        assertTrue("hashcode: a==b", ha == hb);
-        assertTrue("hashcode: a!=d", ha != hd);
-        
-        assertTrue("a==a", a.equals(a));
-        assertTrue("b==b", b.equals(b));
-        assertTrue("d==d", d.equals(d));
-        
-        assertSymEquals("a == b", a,b);
-        
-        assertSymNotEquals("a != d", a,d);
-        assertSymNotEquals("b != d", b,d);
-        
-        assertFalse("a != object", a.equals(new Object()));
-        assertFalse("b != object", b.equals(new Object()));
-        assertFalse("d != object", d.equals(new Object()));
-    }
-    
-    private static void assertSymEquals(String message, Object value1, Object value2) {
-        assertTrue(message, value1.equals(value2) );
-        assertTrue(message, value2.equals(value1) );
-    }
-    
-    private static void assertSymNotEquals(String message, Object value1, Object value2) {
-        assertFalse(message, value1.equals(value2) );
-        assertFalse(message, value2.equals(value1) );
-    }
-    
-    public interface Action {
-        
-        void run() throws Exception;
-        
-    }
-    
-    static RuntimeException rethrow(Throwable cause) {
-        new ExceptionErasure<RuntimeException>().rethrow(cause);
-        
-        // not reachable, wyjątek bez wrappowania leci linię wyżej
-        throw new RuntimeException(cause); // NOPMD
-    }
-    
-    private static class ExceptionErasure<T extends Throwable> { // NOPMD
-        
-        @SuppressWarnings("unchecked")
-        private void rethrow(Throwable exception) throws T {
-            throw (T) exception;
-        }
-
-    }
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/assira.junit
+ */
+package net.ranides.assira.junit;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public final class NewAssert extends org.junit.Assert {
+    
+    private NewAssert() { }
+    
+    public static void assertThrows(Class<? extends Throwable> error, Action action) {
+        try {
+            action.run();
+            fail(error + " expected");
+        } catch(Throwable cause) { // NOPMD
+            if( !error.isInstance(cause)) {
+                throw rethrow(cause);
+            }
+        }
+    }
+    
+    public static void assertSerializable(Object value) {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        try (ObjectOutputStream ostream = new ObjectOutputStream(buffer)) {
+            ostream.writeObject(value);
+            
+            InputStream idata = new ByteArrayInputStream(buffer.toByteArray());
+            try (ObjectInputStream istream = new ObjectInputStream(idata)) {
+                assertEquals(value, istream.readObject());
+            }
+        } catch(IOException | ClassNotFoundException cause) {
+            throw rethrow(cause);
+        }
+    }
+    
+    /**
+     * Requirements (object : hash / pseudo-value)
+     * <pre>
+     *  A : 1 / 1
+     *  B : 1 / 1
+     *  C : 1 / 2
+     *  D : 2 / 3
+     * </pre>
+     * @param a1
+     * @param a2
+     * @param b
+     * @param c 
+     */
+    @SuppressWarnings("PMD.ShortVar")
+    public static void assertEquality(Object a, Object b, Object c, Object d) {
+        int ha = a.hashCode();
+        int hb = b.hashCode();
+        int hc = c.hashCode();
+        int hd = d.hashCode();
+        
+        assertTrue("hashcode: a==b", ha == hb);
+        assertTrue("hashcode: a==c", ha == hc);
+        assertTrue("hashcode: a!=d", ha != hd);
+        
+        assertTrue("a==a", a.equals(a));
+        assertTrue("b==b", b.equals(b));
+        assertTrue("c==c", c.equals(c));
+        assertTrue("d==d", d.equals(d));
+        
+        assertSymEquals("a == b", a,b);
+        
+        assertSymNotEquals("a != c", a,c);
+        assertSymNotEquals("a != d", a,d);
+        assertSymNotEquals("b != c", b,c);
+        assertSymNotEquals("b != d", b,d);
+        assertSymNotEquals("c != d", c,d);
+        
+        assertFalse("a != object", a.equals(new Object()));
+        assertFalse("b != object", b.equals(new Object()));
+        assertFalse("c != object", c.equals(new Object()));
+        assertFalse("d != object", d.equals(new Object()));
+    }
+    
+    /**
+     * Requirements (object : hash / pseudo-value)
+     * <pre>
+     *  A : 1 / 1
+     *  B : 1 / 1
+     *  D : 2 / 2
+     * </pre>
+     * @param a1
+     * @param a2
+     * @param b
+     * @param c 
+     */
+    @SuppressWarnings("PMD.ShortVar")
+    public static void assertEquality(Object a, Object b, Object d) {
+        int ha = a.hashCode();
+        int hb = b.hashCode();
+        int hd = d.hashCode();
+        
+        assertTrue("hashcode: a==b", ha == hb);
+        assertTrue("hashcode: a!=d", ha != hd);
+        
+        assertTrue("a==a", a.equals(a));
+        assertTrue("b==b", b.equals(b));
+        assertTrue("d==d", d.equals(d));
+        
+        assertSymEquals("a == b", a,b);
+        
+        assertSymNotEquals("a != d", a,d);
+        assertSymNotEquals("b != d", b,d);
+        
+        assertFalse("a != object", a.equals(new Object()));
+        assertFalse("b != object", b.equals(new Object()));
+        assertFalse("d != object", d.equals(new Object()));
+    }
+	
+	public static void assertSymEquals(Object value1, Object value2) {
+		assertEquals(value1,value2);
+        assertEquals(value2,value1);
+	}
+    
+    public static void assertSymEquals(String message, Object value1, Object value2) {
+        assertTrue(message, value1.equals(value2) );
+        assertTrue(message, value2.equals(value1) );
+    }
+    
+    private static void assertSymNotEquals(String message, Object value1, Object value2) {
+        assertFalse(message, value1.equals(value2) );
+        assertFalse(message, value2.equals(value1) );
+    }
+    
+    public interface Action {
+        
+        void run() throws Exception;
+        
+    }
+    
+    static RuntimeException rethrow(Throwable cause) {
+        new ExceptionErasure<RuntimeException>().rethrow(cause);
+        
+        // not reachable, wyjątek bez wrappowania leci linię wyżej
+        throw new RuntimeException(cause); // NOPMD
+    }
+    
+    private static class ExceptionErasure<T extends Throwable> { // NOPMD
+        
+        @SuppressWarnings("unchecked")
+        private void rethrow(Throwable exception) throws T {
+            throw (T) exception;
+        }
+
+    }
+}

+ 199 - 194
assira.junit/src/test/java/net/ranides/assira/junit/InterfaceSuiteTest.java

@@ -1,194 +1,199 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.TreeMap;
-import net.ranides.assira.junit.mockup.TesterObjects;
-import net.ranides.assira.junit.mockup.TesterObjects.*;
-import net.ranides.assira.junit.mockup.Testers;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-public class InterfaceSuiteTest {
-    
-    private static final List<String> EXPECTED = Arrays.asList(
-        "ABC.findFirst",
-        "ABC.findAll",
-        "ForA2.exec",
-        "ABC.close",
-        "ABC.open",
-        "ABC.read",
-        "ABC.write",
-        "ABC.next",
-
-        "A.findFirst",
-        "A.findAll",
-        "ForA2.exec",
-
-        "A.findFirst",
-        "A.findAll",
-        "ForA2.exec",
-        "Abstract.close",
-        "Abstract.open",
-        "ForAbstractAB.exec"
-    );
-    
-    private static final List<String> EXPECTED_A = Arrays.asList(
-        "A.findFirst",
-        "A.findAll"
-    );
-    
-    private static final String EXPECTED_OUT = String.format(
-        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [1] ForSupport.ignored - IGNORED%n" +
-        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [2] ForSupport.run%n"+
-        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [3] ForSupport.unsupported - UNSUPPORTED%n"
-    );
-    
-    private static final List<String> EXPECTED_RES = Arrays.asList(
-        "n=ranides c=33", 
-        "n=null c=34", 
-        "n=ot c=0"
-    );
-
-    private static final List<String> EXPECTED_FUNCTION = Arrays.asList(
-        "ForFunction.function", 
-        "ForFunction.list", 
-        "ForFunction.supplier"
-    );
-
-    @Test
-    public void testRun() {
-        InterfaceSuite suite = new InterfaceSuite(System.err)
-            .append(new Testers.ForA1())
-            .append(new Testers.ForB())
-            .append(new Testers.ForC())
-            .append(new Testers.ForAbstractAB())
-            .append(new Testers.ForA2());
-
-        TesterObjects.OUT.clear();
-        suite.run(() -> new ObjectABC());
-        suite.run(() -> new ObjectA());
-        suite.run(() -> new AbstractAB(){});
-        Assert.assertEquals(EXPECTED, TesterObjects.OUT);
-    }
-    
-    @Test
-    public void testInvalid() {
-        NewAssert.assertThrows(AssertionError.class, () ->
-            new InterfaceSuite(System.err).append(new Testers.Invalid())
-        );
-    }
-    
-    @Test
-    public void testCorrect() {
-        InterfaceSuite suite = new InterfaceSuite(System.err)
-            .append(new Testers.Correct());
-
-        TesterObjects.OUT.clear();
-        suite.run(() -> new ObjectA());
-        Assert.assertEquals(EXPECTED_A, TesterObjects.OUT);
-    }
-    
-    @Test
-    public void testSupport() {
-        TeeStream out = new TeeStream(System.err);
-        InterfaceSuite suite = new InterfaceSuite(new PrintStream(out))
-            .append(new Testers.ForSupport())
-            .ignore("ForSupport.ignored");
-
-        TesterObjects.OUT.clear();
-        suite.run(() -> new ObjectA());
-        Assert.assertEquals(EXPECTED_OUT, out.toString());
-        Assert.assertEquals(EXPECTED_A, TesterObjects.OUT);
-    }
-    
-    @Test
-    public void testMapSupplier() {
-        TesterObjects.OUT.clear();
-        
-        new InterfaceSuite(System.err)
-            .append(new Testers.ForMap())
-            .run(() -> new TreeMap<>());
-        Assert.assertEquals(Arrays.asList("map"), TesterObjects.OUT);
-    }
-    
-    @Test
-    public void testWildcardSupplier() {
-        NewAssert.assertThrows(AssertionError.class, ()->{
-            new InterfaceSuite(System.err)
-                .append(new Testers.ForWildcard())
-                .run(() -> new TreeMap<>());
-        });
-    }
-    
-    @Test
-    public void testFunction() {
-        TesterObjects.OUT.clear();
-        new InterfaceSuite(System.err)
-            .append(new Testers.ForFunction())
-            .run((int[] args) -> new ArrayList<>());
-        Assert.assertEquals(EXPECTED_FUNCTION, TesterObjects.OUT);
-    }
-    
-    @Test
-    public void testResources() {
-        TesterObjects.OUT.clear();
-        InterfaceSuite suite = new InterfaceSuite(System.err)
-            .append(new Testers.ForResource());
-        suite
-            .param("name", "ranides")
-            .param("count!", 33)
-            .run(() -> new Object());
-        suite
-            .param("count!", 34)
-            .run(() -> new Object());
-        suite
-            .param("name", "ot")
-            .run(() -> new Object());
-        Assert.assertEquals(EXPECTED_RES, TesterObjects.OUT);
-    }
-    
-    private static class TeeStream extends FilterOutputStream {
-
-        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-        
-        public TeeStream(OutputStream out) {
-            super(out);
-        }
-        
-        @Override
-        public void write(int b) throws IOException {
-            bytes.write(b);
-            super.write(b);
-        }
-        
-        @Override
-        public String toString() {
-            try {
-                return bytes.toString(StandardCharsets.UTF_8.name());
-            } catch (UnsupportedEncodingException ex) {
-                throw NewAssert.rethrow(ex);
-            }
-        }
-        
-    }
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/assira.junit
+ */
+package net.ranides.assira.junit;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.TreeMap;
+import java.util.regex.Pattern;
+import net.ranides.assira.junit.mockup.TesterObjects;
+import net.ranides.assira.junit.mockup.TesterObjects.*;
+import net.ranides.assira.junit.mockup.Testers;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+public class InterfaceSuiteTest {
+    
+    private static final List<String> EXPECTED = Arrays.asList(
+        "ABC.findFirst",
+        "ABC.findAll",
+        "ForA2.exec",
+        "ABC.close",
+        "ABC.open",
+        "ABC.read",
+        "ABC.write",
+        "ABC.next",
+
+        "A.findFirst",
+        "A.findAll",
+        "ForA2.exec",
+
+        "A.findFirst",
+        "A.findAll",
+        "ForA2.exec",
+        "Abstract.close",
+        "Abstract.open",
+        "ForAbstractAB.exec"
+    );
+    
+    private static final List<String> EXPECTED_A = Arrays.asList(
+        "A.findFirst",
+        "A.findAll"
+    );
+    
+    private static final String EXPECTED_OUT = String.format(
+        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [1] ForSupport.ignored - IGNORED%n" +
+        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [2] ForSupport.otherMethod4Pattern - IGNORED%n" +
+        " - SUITE: net.ranides.assira.junit.mockup.TesterInterfaces$IntA [3] ForSupport.run%n"
+    );
+    
+    private static final List<String> EXPECTED_RES = Arrays.asList(
+        "n=ranides c=33", 
+        "n=null c=34", 
+        "n=ot c=0"
+    );
+
+    private static final List<String> EXPECTED_FUNCTION = Arrays.asList(
+        "ForFunction.function", 
+        "ForFunction.list", 
+        "ForFunction.supplier"
+    );
+
+    @Test
+    public void testRun() {
+        InterfaceSuite suite = new InterfaceSuite(System.err)
+            .append(new Testers.ForA1())
+            .append(new Testers.ForB())
+            .append(new Testers.ForC())
+            .append(new Testers.ForAbstractAB())
+            .append(new Testers.ForA2());
+
+        TesterObjects.OUT.clear();
+        suite.run(() -> new ObjectABC());
+        suite.run(() -> new ObjectA());
+        suite.run(() -> new AbstractAB(){});
+        Assert.assertEquals(EXPECTED, TesterObjects.OUT);
+    }
+    
+    @Test
+    public void testInvalid() {
+        NewAssert.assertThrows(AssertionError.class, () ->
+            new InterfaceSuite(System.err).append(new Testers.Invalid())
+        );
+    }
+    
+    @Test
+    public void testCorrect() {
+        InterfaceSuite suite = new InterfaceSuite(System.err)
+            .append(new Testers.Correct());
+
+        TesterObjects.OUT.clear();
+        suite.run(() -> new ObjectA());
+        Assert.assertEquals(EXPECTED_A, TesterObjects.OUT);
+    }
+    
+    @Test
+    public void testSupport() {
+        TeeStream out = new TeeStream(System.err);
+        InterfaceSuite suite = new InterfaceSuite(new PrintStream(out))
+            .append(new Testers.ForSupport())
+            .ignore("ForSupport.ignored")
+            .ignore(Pattern.compile(".*Method4Pa.*"))
+			.debug(true);
+
+        TesterObjects.OUT.clear();
+        suite.run(() -> new ObjectA());
+		System.out.println(">>>" + out.toString());
+		System.out.println(">>>" + EXPECTED_OUT);
+        Assert.assertEquals(EXPECTED_OUT, out.toString());
+        Assert.assertEquals(EXPECTED_A, TesterObjects.OUT);
+    }
+    
+    @Test
+    public void testMapSupplier() {
+        TesterObjects.OUT.clear();
+        
+        new InterfaceSuite(System.err)
+            .append(new Testers.ForMap())
+            .run(() -> new TreeMap<>());
+        Assert.assertEquals(Arrays.asList("map"), TesterObjects.OUT);
+    }
+    
+    @Test
+    public void testWildcardSupplier() {
+        NewAssert.assertThrows(AssertionError.class, ()->{
+            new InterfaceSuite(System.err)
+                .append(new Testers.ForWildcard())
+                .run(() -> new TreeMap<>());
+        });
+    }
+    
+    @Test
+    public void testFunction() {
+        TesterObjects.OUT.clear();
+        new InterfaceSuite(System.err)
+            .append(new Testers.ForFunction())
+            .run((int[] args) -> new ArrayList<>());
+        Assert.assertEquals(EXPECTED_FUNCTION, TesterObjects.OUT);
+    }
+    
+    @Test
+    public void testResources() {
+        TesterObjects.OUT.clear();
+        InterfaceSuite suite = new InterfaceSuite(System.err)
+            .append(new Testers.ForResource());
+        suite
+            .param("name", "ranides")
+            .param("count!", 33)
+            .run(() -> new Object());
+        suite
+            .param("count!", 34)
+            .run(() -> new Object());
+        suite
+            .param("name", "ot")
+            .run(() -> new Object());
+        Assert.assertEquals(EXPECTED_RES, TesterObjects.OUT);
+    }
+    
+    private static class TeeStream extends FilterOutputStream {
+
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        
+        public TeeStream(OutputStream out) {
+            super(out);
+        }
+        
+        @Override
+        public void write(int b) throws IOException {
+            bytes.write(b);
+            super.write(b);
+        }
+        
+        @Override
+        public String toString() {
+            try {
+                return bytes.toString(StandardCharsets.UTF_8.name());
+            } catch (UnsupportedEncodingException ex) {
+                throw NewAssert.rethrow(ex);
+            }
+        }
+        
+    }
+    
+}

+ 192 - 192
assira.junit/src/test/java/net/ranides/assira/junit/mockup/Testers.java

@@ -1,192 +1,192 @@
-/*
- * @author Ranides Atterwim <ranides@gmail.com>
- * @copyright Ranides Atterwim
- * @license WTFPL
- * @url http://ranides.net/projects/assira.junit
- */
-package net.ranides.assira.junit.mockup;
-
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import javax.annotation.Resource;
-import net.ranides.assira.junit.InterfaceTest;
-import net.ranides.assira.junit.mockup.TesterObjects.*;
-import net.ranides.assira.junit.mockup.TesterInterfaces.*;
-import org.junit.Ignore;
-
-/**
- *
- * @author Ranides Atterwim <ranides@gmail.com>
- */
-@SuppressWarnings("PMD")
-public class Testers {
-    
-    public static class ForA1 {
-
-        @InterfaceTest
-        public void run(IntA object) {
-            object.findFirst();
-            object.findAll();
-        }
-
-    }
-        
-    public static class ForA2 {
-
-        @InterfaceTest
-        public void exec(IntA object) {
-            TesterObjects.OUT.add("ForA2.exec");
-        }
-
-    }
-    
-    public static class ForFunction {
-
-        @InterfaceTest
-        public void supplier(Supplier<List<String>> s) {
-            TesterObjects.OUT.add("ForFunction.supplier");
-        }
-        
-        @InterfaceTest
-        public void function(Function<int[], List<String>> f) {
-            TesterObjects.OUT.add("ForFunction.function");
-        }
-        
-        @InterfaceTest
-        public void list(List<String> list) {
-            TesterObjects.OUT.add("ForFunction.list");
-        }
-
-    }
-    
-    public static class ForSupport {
-
-        @InterfaceTest
-        public void run(IntA object) {
-            object.findFirst();
-            object.findAll();
-        }
-        
-        @InterfaceTest
-        public void unsupported(IntA object) {
-            throw new UnsupportedOperationException("NO TEST");
-        }
-        
-        @InterfaceTest
-        public void ignored(IntA object) {
-            throw new NumberFormatException();
-        }
-
-    }
-    
-    public static class Invalid {
-
-        @InterfaceTest
-        public void run(IntA object) {
-            object.findFirst();
-            object.findAll();
-        }
-        
-        @InterfaceTest
-        public void other(IntA object, int params) {
-            object.findFirst();
-            object.findAll();
-        }
-
-    }
-    
-    public static class Correct {
-
-        @InterfaceTest
-        public void run(IntA object) {
-            object.findFirst();
-            object.findAll();
-        }
-        
-        @Ignore
-        @InterfaceTest
-        public void other(IntA object, int params) {
-            object.findFirst();
-            object.findAll();
-        }
-
-    }
-
-    public static class ForB {
-
-        @InterfaceTest
-        public void runO(IntB object) {
-            object.open();
-        }
-
-        @InterfaceTest
-        public void runC(IntB object) {
-            object.close();
-        }
-
-    }
-
-    public static class ForC {
-
-        @InterfaceTest
-        public void runR(IntC object) {
-            object.read();
-        }
-
-        @InterfaceTest
-        public void runW(IntC object) {
-            object.write();
-        }
-        
-        @InterfaceTest
-        public void runZ(Supplier<IntC> function) {
-            function.get().next();
-        }
-
-    }
-    
-    public static class ForAbstractAB {
-        
-        @InterfaceTest
-        public void exec(AbstractAB that) {
-            TesterObjects.OUT.add("ForAbstractAB.exec");
-        }
-                
-    }
-    
-    public static class ForMap {
-        
-        @InterfaceTest
-        public void exec(Supplier<Map<Integer, String>> supplier) {
-            TesterObjects.OUT.add("map");
-        }
- 
-    }
-    
-    public static class ForWildcard {
-        
-        @InterfaceTest
-        public void wildcard(Supplier<? extends Map<Integer, String>> supplier) {
-            TesterObjects.OUT.add("map");
-        }
-        
-    }
-    
-    public static class ForResource {
-        
-        @Resource
-        private String name;
-        
-        @Resource(name="count!")
-        private int count;
-        
-        @InterfaceTest
-        public void run(Object input) {
-            TesterObjects.OUT.add("n=" +name + " c="+count);
-        }
-        
-    }
-    
-}
+/*
+ * @author Ranides Atterwim <ranides@gmail.com>
+ * @copyright Ranides Atterwim
+ * @license WTFPL
+ * @url http://ranides.net/projects/assira.junit
+ */
+package net.ranides.assira.junit.mockup;
+
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import javax.annotation.Resource;
+import net.ranides.assira.junit.InterfaceTest;
+import net.ranides.assira.junit.mockup.TesterObjects.*;
+import net.ranides.assira.junit.mockup.TesterInterfaces.*;
+import org.junit.Ignore;
+
+/**
+ *
+ * @author Ranides Atterwim <ranides@gmail.com>
+ */
+@SuppressWarnings("PMD")
+public class Testers {
+    
+    public static class ForA1 {
+
+        @InterfaceTest
+        public void run(IntA object) {
+            object.findFirst();
+            object.findAll();
+        }
+
+    }
+        
+    public static class ForA2 {
+
+        @InterfaceTest
+        public void exec(IntA object) {
+            TesterObjects.OUT.add("ForA2.exec");
+        }
+
+    }
+    
+    public static class ForFunction {
+
+        @InterfaceTest
+        public void supplier(Supplier<List<String>> s) {
+            TesterObjects.OUT.add("ForFunction.supplier");
+        }
+        
+        @InterfaceTest
+        public void function(Function<int[], List<String>> f) {
+            TesterObjects.OUT.add("ForFunction.function");
+        }
+        
+        @InterfaceTest
+        public void list(List<String> list) {
+            TesterObjects.OUT.add("ForFunction.list");
+        }
+
+    }
+    
+    public static class ForSupport {
+
+        @InterfaceTest
+        public void run(IntA object) {
+            object.findFirst();
+            object.findAll();
+        }
+        
+        @InterfaceTest
+        public void ignored(IntA object) {
+            throw new NumberFormatException();
+        }
+		
+		@InterfaceTest
+        public void otherMethod4Pattern(IntA object) {
+            throw new NumberFormatException();
+        }
+
+    }
+    
+    public static class Invalid {
+
+        @InterfaceTest
+        public void run(IntA object) {
+            object.findFirst();
+            object.findAll();
+        }
+        
+        @InterfaceTest
+        public void other(IntA object, int params) {
+            object.findFirst();
+            object.findAll();
+        }
+
+    }
+    
+    public static class Correct {
+
+        @InterfaceTest
+        public void run(IntA object) {
+            object.findFirst();
+            object.findAll();
+        }
+        
+        @Ignore
+        @InterfaceTest
+        public void other(IntA object, int params) {
+            object.findFirst();
+            object.findAll();
+        }
+
+    }
+
+    public static class ForB {
+
+        @InterfaceTest
+        public void runO(IntB object) {
+            object.open();
+        }
+
+        @InterfaceTest
+        public void runC(IntB object) {
+            object.close();
+        }
+
+    }
+
+    public static class ForC {
+
+        @InterfaceTest
+        public void runR(IntC object) {
+            object.read();
+        }
+
+        @InterfaceTest
+        public void runW(IntC object) {
+            object.write();
+        }
+        
+        @InterfaceTest
+        public void runZ(Supplier<IntC> function) {
+            function.get().next();
+        }
+
+    }
+    
+    public static class ForAbstractAB {
+        
+        @InterfaceTest
+        public void exec(AbstractAB that) {
+            TesterObjects.OUT.add("ForAbstractAB.exec");
+        }
+                
+    }
+    
+    public static class ForMap {
+        
+        @InterfaceTest
+        public void exec(Supplier<Map<Integer, String>> supplier) {
+            TesterObjects.OUT.add("map");
+        }
+ 
+    }
+    
+    public static class ForWildcard {
+        
+        @InterfaceTest
+        public void wildcard(Supplier<? extends Map<Integer, String>> supplier) {
+            TesterObjects.OUT.add("map");
+        }
+        
+    }
+    
+    public static class ForResource {
+        
+        @Resource
+        private String name;
+        
+        @Resource(name="count!")
+        private int count;
+        
+        @InterfaceTest
+        public void run(Object input) {
+            TesterObjects.OUT.add("n=" +name + " c="+count);
+        }
+        
+    }
+    
+}