Skip to content

Commit

Permalink
Merge pull request #41 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth authored Jul 13, 2023
2 parents 484a222 + 0ba0603 commit 62f0478
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Changed
- Client version updated on [5.1.22](https://github.com/reportportal/client-java/releases/tag/5.1.22), by @HardNorth

## [5.1.2]
### Fixed
Expand Down
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,26 @@ targetCompatibility = 1.8

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}

dependencies {
api "com.epam.reportportal:client-java:5.1.17"
api "com.epam.reportportal:client-java:5.1.22"
api "com.epam.reportportal:commons-model:5.0.0"
api "org.spockframework:spock-core:${spock_version}"
api 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-api:2.0.7'

testImplementation 'org.codehaus.groovy:groovy:2.5.14'
testImplementation 'com.github.reportportal:agent-java-test-utils:236a68c'
testImplementation 'org.aspectj:aspectjweaver:1.9.2'

testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.2'

testImplementation 'org.aspectj:aspectjweaver:1.9.19'
testImplementation 'org.hamcrest:hamcrest-core:2.2'
testImplementation "org.mockito:mockito-core:${mockito_version}"
testImplementation "org.mockito:mockito-inline:${mockito_version}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockito_version}"
testImplementation 'ch.qos.logback:logback-classic:1.2.11'
testImplementation 'com.epam.reportportal:logger-java-logback:5.1.3'
testImplementation 'ch.qos.logback:logback-classic:1.3.8'
testImplementation 'com.epam.reportportal:logger-java-logback:5.1.6'
testImplementation ("org.junit.platform:junit-platform-runner:${junit5_launcher_version}") {
exclude module: 'junit'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@
* The best approach is to have only one instance
*/
public class ReportPortalSpockListener extends AbstractRunListener {

private static final Logger LOGGER = LoggerFactory.getLogger(ReportPortalSpockListener.class);

private static final Method[] ITERATION_METHODS = IterationInfo.class.getMethods();
private static final Method DISPLAY_NAME_METHOD = Arrays.stream(ITERATION_METHODS)
.filter(m -> "getDisplayName".equals(m.getName()))
.findAny()
.orElseGet(
() -> Arrays.stream(ITERATION_METHODS)
.filter(m -> "getName".equals(m.getName()))
.findAny()
.orElseThrow(() -> new IllegalStateException("Unknown Spock version."))
);

private final MemoizingSupplier<Launch> launch;

// stores the bindings of Spock method kinds to the RP-specific notation
Expand Down Expand Up @@ -230,22 +241,9 @@ protected StartTestItemRQ buildNestedIterationItemRq(@Nonnull IterationInfo iter

@Nonnull
protected StartTestItemRQ buildIterationItemRq(@Nonnull IterationInfo iteration) {
Method[] iterationMethods = iteration.getClass().getMethods();
Method displayNameMethod = Arrays.stream(iterationMethods)
.filter(m -> "getDisplayName".equals(m.getName()))
.findAny()
.orElseGet(
() -> Arrays.stream(iterationMethods)
.filter(m -> "getName".equals(m.getName()))
.findAny()
.orElse(null)
);
if (displayNameMethod == null) {
throw new IllegalStateException("Unknown Spock version.");
}
String displayName;
try {
displayName = (String) displayNameMethod.invoke(iteration);
displayName = (String) DISPLAY_NAME_METHOD.invoke(iteration);
} catch (InvocationTargetException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
Expand Down

0 comments on commit 62f0478

Please sign in to comment.