Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish static nested test classes #2531

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions core/src/test/java/feign/EnumForNameTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 The Feign Authors
* Copyright 2012-2024 The Feign Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -16,15 +16,13 @@
import static feign.Util.enumForName;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import feign.Request.ProtocolVersion;

public class EnumForNameTest {

@Nested
public static class KnownEnumValues {
public static class KnownEnumValuesTest {
public Object name;
public ProtocolVersion expectedProtocolVersion;

Expand Down Expand Up @@ -54,8 +52,7 @@ public void initKnownEnumValues(Object name, ProtocolVersion expectedProtocolVer

}

@Nested
public static class UnknownEnumValues {
public static class UnknownEnumValuesTest {

public Object name;

Expand Down
9 changes: 1 addition & 8 deletions core/src/test/java/feign/LoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ String login(@Param("customer_name") String customer,
@Param("password") String password);
}

@Nested
public static class LogLevelEmitsTest extends LoggerTest {

private Level logLevel;
Expand Down Expand Up @@ -98,8 +97,7 @@ void levelEmits(Level logLevel, List<String> expectedMessages) {
}
}

@Nested
public static class ReasonPhraseOptional extends LoggerTest {
public static class ReasonPhraseOptionalTest extends LoggerTest {

private Level logLevel;

Expand Down Expand Up @@ -128,7 +126,6 @@ void reasonPhraseOptional(Level logLevel, List<String> expectedMessages) {
}
}

@Nested
public static class HttpProtocolVersionTest extends LoggerTest {

private Level logLevel;
Expand Down Expand Up @@ -174,7 +171,6 @@ void httpProtocolVersion(Level logLevel,
}
}

@Nested
public static class ReadTimeoutEmitsTest extends LoggerTest {

private Level logLevel;
Expand Down Expand Up @@ -231,7 +227,6 @@ public Retryer clone() {
}
}

@Nested
public static class UnknownHostEmitsTest extends LoggerTest {

private Level logLevel;
Expand Down Expand Up @@ -283,7 +278,6 @@ public Retryer clone() {
}
}

@Nested
public static class FormatCharacterTest extends LoggerTest {

private Level logLevel;
Expand Down Expand Up @@ -335,7 +329,6 @@ public Retryer clone() {
}
}

@Nested
public static class RetryEmitsTest extends LoggerTest {

private Level logLevel;
Expand Down
7 changes: 1 addition & 6 deletions core/src/test/java/feign/MethodInfoTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 The Feign Authors
* Copyright 2012-2024 The Feign Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -18,14 +18,12 @@
import java.lang.reflect.Type;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;



public class MethodInfoTest {

@Nested
static class AsyncClientTest {
public interface AsyncClient {
CompletableFuture<String> log();
Expand All @@ -39,7 +37,6 @@ void completableFutureOfString() throws Exception {
}
}

@Nested
static class GenericAsyncClientTest {
public interface GenericAsyncClient<T> {
T log();
Expand All @@ -56,7 +53,6 @@ void genericCompletableFutureOfString() throws Exception {
}
}

@Nested
static class SyncClientTest {
public interface SyncClient {
String log();
Expand All @@ -70,7 +66,6 @@ void string() throws Exception {
}
}

@Nested
static class GenericSyncClientTest {
public interface GenericSyncClient<T> {
T log();
Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<argLine>${jvm.options}</argLine>
<excludes>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that inner static test classes are not executed. Tests inside LoggerTest are ignored.

junit-team/junit5#1377 (comment)
https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<exclude/>
</excludes>
</configuration>
</plugin>

Expand Down
Loading