Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced visitor for JUnit5Testable to get rid of instanceof testing
- Loading branch information
Showing
6 changed files
with
298 additions
and
185 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
junit5-engine/src/main/java/org/junit/gen5/engine/junit5/descriptor/JUnit5Class.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
/* | |||
* Copyright 2015 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.gen5.engine.junit5.descriptor; | |||
|
|||
import lombok.Value; | |||
|
|||
@Value | |||
public class JUnit5Class extends JUnit5Testable { | |||
|
|||
private final Class<?> javaClass; | |||
|
|||
JUnit5Class(String uniqueId, Class<?> javaClass) { | |||
super(uniqueId); | |||
this.javaClass = javaClass; | |||
} | |||
|
|||
public void accept(Visitor visitor) { | |||
visitor.visitClass(getUniqueId(), javaClass); | |||
} | |||
|
|||
} |
33 changes: 33 additions & 0 deletions
33
junit5-engine/src/main/java/org/junit/gen5/engine/junit5/descriptor/JUnit5Method.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
/* | |||
* Copyright 2015 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.gen5.engine.junit5.descriptor; | |||
|
|||
import java.lang.reflect.Method; | |||
|
|||
import lombok.Value; | |||
|
|||
@Value | |||
public class JUnit5Method extends JUnit5Testable { | |||
|
|||
private final Class<?> containerClass; | |||
private final Method javaMethod; | |||
|
|||
JUnit5Method(String uniqueId, Method javaElement, Class<?> containerClass) { | |||
super(uniqueId); | |||
this.javaMethod = javaElement; | |||
this.containerClass = containerClass; | |||
} | |||
|
|||
public void accept(Visitor visitor) { | |||
visitor.visitMethod(getUniqueId(), javaMethod, containerClass); | |||
} | |||
|
|||
} |
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
Oops, something went wrong.