From: SourceForge.net <no...@so...> - 2009-09-25 09:39:26
|
Bugs item #2866423, was opened at 2009-09-25 11:39 Message generated for change (Tracker Item Submitted) made by reinholdfuerede You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115278&aid=2866423&group_id=15278 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: framework Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Reinhold Füreder (reinholdfuerede) Assigned to: Nobody/Anonymous (nobody) Summary: Only one (the laste) filter is considered Initial Comment: In the course of upgrading from JUnit 4.4 to JUnit 4.7 I stumbled over this bug: @Test public void testMultipleFilters() throws Exception { JUnitCore junitCore = new JUnitCore(); Request request = Request.aClass(ExampleTest.class); Request requestFiltered = request.filterWith(new SingleMethodNameFilter("test1")); Request requestFilteredFiltered = requestFiltered.filterWith(new SingleMethodNameFilter("test2")); Result result = junitCore.run(requestFilteredFiltered); printResult(result); assertEquals(1, result.getRunCount()); // Fails here: actual 2 } private static class SingleMethodNameFilter extends Filter { private String methodName; public SingleMethodNameFilter(String methodName) { this.methodName = methodName; } @Override public boolean shouldRun(Description description) { return !description.getMethodName().equals(methodName); } @Override public String describe() { return "filter method name: " + methodName; } } public class ExampleTest { @Test public void test1() throws Exception { System.out.println("Run: test1"); assertEquals(1, 1); } @Test public void test2() throws Exception { System.out.println("Run: test2"); assertEquals(1, 1); } @Test public void test3() throws Exception { System.out.println("Run: test3"); assertEquals(1, 1); } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115278&aid=2866423&group_id=15278 |