Skip to content

Commit 12facd8

Browse files
authored
Re-enable JUnit 4 and JUnit 3 unit tests (#3273)
When JUnit 5 support was added to the project, the "JUnit Vintage Engine" artifact wasn't added. Without this artifact, the JUnit 5 engine ignores any tests written for JUnit 4 or JUnit 3, i.e. the majority of the tests.
1 parent bc18c36 commit 12facd8

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
1010

1111
## Unreleased ([details][unreleased changes details])
1212

13+
### Fix
14+
15+
- Re-enable accidentally disabled unit tests
16+
1317
## 6.4.0 - 2024-02-22
1418

1519
## Added

bundle/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,12 @@
500500
</dependency>
501501
<dependency>
502502
<groupId>org.junit.jupiter</groupId>
503-
<artifactId>junit-jupiter</artifactId>
503+
<artifactId>junit-jupiter-api</artifactId>
504+
<scope>test</scope>
505+
</dependency>
506+
<dependency>
507+
<groupId>org.junit.jupiter</groupId>
508+
<artifactId>junit-jupiter-params</artifactId>
504509
<scope>test</scope>
505510
</dependency>
506511
<dependency>

bundle/src/test/java/com/adobe/acs/commons/packagegarbagecollector/PackageGarbageCollectionJobTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import static com.adobe.acs.commons.testutil.LogTester.assertLogText;
4949
import static org.junit.Assert.assertEquals;
5050
import static org.mockito.ArgumentMatchers.*;
51+
import static org.mockito.Mockito.lenient;
5152
import static org.mockito.Mockito.mock;
5253
import static org.mockito.Mockito.when;
5354

@@ -134,7 +135,7 @@ JcrPackage mockPackage(Integer daysAgo, Integer lastUnpackedDaysAgo, String pack
134135
JcrPackageDefinition definition = mock(JcrPackageDefinition.class);
135136
when(definition.getLastUnpacked()).thenReturn(getDate(lastUnpackedDaysAgo));
136137
when(definition.getLastUnwrapped()).thenReturn(getDate(daysAgo));
137-
when(definition.getCreated()).thenReturn(null);
138+
lenient().when(definition.getCreated()).thenReturn(null);
138139
when(definition.getNode()).thenReturn(packageNode);
139140
PackageId pid = mock(PackageId.class);
140141
when(pid.getName()).thenReturn(name);

bundle/src/test/java/com/adobe/acs/commons/remoteassets/impl/RemoteAssetsConfigImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public Distribution getDistribution() {
6969
}
7070
};
7171
context.registerService(RequireAem.class, requireAem, "distribution","classic");
72+
LogTester.reset();
7273
}
7374

7475
@Test

pom.xml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<aem.sdk.api.version>2023.1.10675.20230113T110236Z-220900</aem.sdk.api.version>
9090

9191
<jacoco.version>0.8.7</jacoco.version>
92+
<junit.jupiter.version>5.10.0</junit.jupiter.version> <!-- >= 5.x requires Java 11 -->
9293
<!-- affects both m-compiler-p and m-javadoc-p-->
9394
<maven.compiler.release>8</maven.compiler.release>
9495
<!-- for reproducible builds (https://maven.apache.org/guides/mini/guide-reproducible-builds.html), automatically adjusted during release -->
@@ -138,6 +139,18 @@
138139
<configuration>
139140
<trimStackTrace>false</trimStackTrace>
140141
</configuration>
142+
<dependencies>
143+
<dependency>
144+
<groupId>org.junit.jupiter</groupId>
145+
<artifactId>junit-jupiter-engine</artifactId>
146+
<version>${junit.jupiter.version}</version>
147+
</dependency>
148+
<dependency>
149+
<groupId>org.junit.vintage</groupId>
150+
<artifactId>junit-vintage-engine</artifactId>
151+
<version>${junit.jupiter.version}</version>
152+
</dependency>
153+
</dependencies>
141154
</plugin>
142155
<plugin>
143156
<artifactId>maven-failsafe-plugin</artifactId>
@@ -605,10 +618,11 @@ Service-Component: OSGI-INF/*.xml
605618
<scope>test</scope>
606619
</dependency>
607620
<dependency>
608-
<groupId>org.junit.jupiter</groupId>
609-
<artifactId>junit-jupiter</artifactId>
610-
<version>5.10.0</version>
611-
<scope>test</scope>
621+
<groupId>org.junit</groupId>
622+
<artifactId>junit-bom</artifactId>
623+
<version>${junit.jupiter.version}</version>
624+
<type>pom</type>
625+
<scope>import</scope>
612626
</dependency>
613627
<dependency>
614628
<groupId>junit</groupId>

0 commit comments

Comments
 (0)