Skip to content

Commit

Permalink
Add a minimal test for the parser
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Jan 20, 2024
1 parent 722be12 commit 4436707
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void main(String[] args) throws IOException {
parseDefinitionMigrations(repo, csv);
}

private static void parseDefinitionMigrations(File repo, File csv) throws IOException {
static void parseDefinitionMigrations(File repo, File csv) throws IOException {
ObjectMapper objectMapper = getObjectMapper();

Path uc = repo.toPath().resolve("uc");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.openrewrite.java.dependencies.oldgroupids;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

import static org.assertj.core.api.Assertions.assertThat;

class ParseDefinitionMigrationsTest {
@Test
void parseDefinitionMigrations(@TempDir Path tempDir) throws IOException {
ParseDefinitionMigrations parseDefinitionMigrations = new ParseDefinitionMigrations();
Path csv = tempDir.resolve("migrations.csv");
parseDefinitionMigrations.parseDefinitionMigrations(new File("src/test/resources"), csv.toFile());
assertThat(csv).hasContent("""
acegisecurity,,org.acegisecurity,,
activation,activation,javax.activation,activation,
com.jcraft,jsch,com.github.mwiede,jsch,"See https://www.matez.de/index.php/2020/06/22/the-future-of-jsch-without-ssh-rsa/"
""");
}
}
13 changes: 13 additions & 0 deletions src/test/resources/uc/og-definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"date": "2024/12/05",
"migration": [
{
"old": "acegisecurity",
"new": "org.acegisecurity"
},
{
"old": "activation:activation",
"new": "javax.activation:activation"
}
]
}
12 changes: 12 additions & 0 deletions src/test/resources/uc/og-unofficial-definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"date": "2024/01/12",
"migration": [
{
"old": "com.jcraft:jsch",
"proposal": [
"com.github.mwiede:jsch"
],
"context": "See https://www.matez.de/index.php/2020/06/22/the-future-of-jsch-without-ssh-rsa/"
}
]
}

0 comments on commit 4436707

Please sign in to comment.