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

5571migrate tests to junit5 #6121

Closed
Closed
Show file tree
Hide file tree
Changes from 4 commits
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Please exclude IDE files from commits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IDE files removed from commit. Include .vscode/ in gitignore

"java.configuration.updateBuildConfiguration": "interactive"
}
2 changes: 1 addition & 1 deletion besu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dependencies {
testImplementation 'com.squareup.okhttp3:okhttp'
testImplementation 'commons-io:commons-io'
testImplementation 'io.opentelemetry:opentelemetry-api'
testImplementation 'junit:junit'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'org.apache.commons:commons-text'
testImplementation 'io.tmio:tuweni-bytes'
testImplementation 'io.tmio:tuweni-units'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,21 @@
import java.util.concurrent.CompletionException;

import org.apache.tuweni.units.bigints.UInt256;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.io.TempDir;
import org.mockito.junit.jupiter.MockitoExtension;

/** Tests for {@link RlpBlockImporter}. */
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public final class RlpBlockImporterTest {

@Rule public final TemporaryFolder folder = new TemporaryFolder();
@TempDir Path dataDir;

private final RlpBlockImporter rlpBlockImporter = new RlpBlockImporter();

@Test
public void blockImport() throws IOException {
final Path dataDir = folder.newFolder().toPath();
final Path source = dataDir.resolve("1000.blocks");
BlockTestUtil.write1000Blocks(source);
final BesuController targetController =
Expand Down Expand Up @@ -90,7 +88,6 @@ public void blockImportRejectsBadPow() throws IOException {
// set merge flag to false, otherwise this test can fail if a merge test runs first
MergeConfigOptions.setMergeEnabled(false);

final Path dataDir = folder.newFolder().toPath();
final Path source = dataDir.resolve("badpow.blocks");
BlockTestUtil.writeBadPowBlocks(source);
final BesuController targetController =
Expand Down Expand Up @@ -120,7 +117,6 @@ public void blockImportRejectsBadPow() throws IOException {

@Test
public void blockImportCanSkipPow() throws IOException {
final Path dataDir = folder.newFolder().toPath();
final Path source = dataDir.resolve("badpow.blocks");
BlockTestUtil.writeBadPowBlocks(source);
final BesuController targetController =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public void toURI_WithHostnameShouldWorkWhenDnsEnabledAndUpdateEnabled()
"enode://"
+ VALID_NODE_ID
+ "@"
+ InetAddress.getLocalHost().getCanonicalHostName()
+ InetAddress.getLocalHost().getHostName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related to Junit5 port?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, just a mistake.

+ ":"
+ P2P_PORT;
final URI expectedURI = URI.create(enodeURLString);
Expand Down
Loading