-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression for test class hierarchies without bridge methods
Code introduced by [1] broke standard support for test class hierarchies without bridge or synthetic methods present. This commit fixes the regression by inspecting the return and parameter types of the upper method for usage of generic-related types. [1] 82174c1
- Loading branch information
Showing
5 changed files
with
145 additions
and
8 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...jupiter-engine/src/test/java/org/junit/jupiter/engine/bridge/AbstractNonGenericTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2015-2017 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v1.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.junit.jupiter.engine.bridge; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* @since 5.0 | ||
*/ | ||
@ExtendWith(NumberResolver.class) | ||
abstract class AbstractNonGenericTests { | ||
|
||
@Test | ||
void mA() { | ||
BridgeMethodTests.sequence.add("mA()"); | ||
} | ||
|
||
@Test | ||
void test(Number value) { | ||
BridgeMethodTests.sequence.add("A.test(Number)"); | ||
Assertions.assertEquals(42, value); | ||
} | ||
|
||
static class B extends AbstractNonGenericTests { | ||
|
||
@Test | ||
void mB() { | ||
BridgeMethodTests.sequence.add("mB()"); | ||
} | ||
|
||
@Test | ||
void test(Byte value) { | ||
BridgeMethodTests.sequence.add("B.test(Byte)"); | ||
Assertions.assertEquals(123, value.intValue()); | ||
} | ||
|
||
} | ||
|
||
static class C extends B { | ||
|
||
@Test | ||
void mC() { | ||
BridgeMethodTests.sequence.add("mC()"); | ||
} | ||
|
||
@Override | ||
@Test | ||
void test(Byte value) { | ||
BridgeMethodTests.sequence.add("C.test(Byte)"); | ||
Assertions.assertEquals(123, value.intValue()); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters