Skip to content

Commit 311415d

Browse files
authored
[Misc] Make JUnit5 test classes and methods package-private (SonarCloud java:S5786)
Remove redundant public visibility modifiers from JUnit5 test classes and their test/lifecycle methods across 7 modules, as reported by SonarCloud rule java:S5786. Test code only, behaviour-preserving.
1 parent 4c0dbf3 commit 311415d

31 files changed

Lines changed: 60 additions & 60 deletions

File tree

xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/test/java/org/xwiki/like/internal/DefaultLikeConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* @since 12.7RC1
3939
*/
4040
@ComponentTest
41-
public class DefaultLikeConfigurationTest
41+
class DefaultLikeConfigurationTest
4242
{
4343
@InjectMockComponents
4444
private DefaultLikeConfiguration defaultLikeConfiguration;

xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/test/java/org/xwiki/like/internal/LikeExistCacheEntryListenerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
* @version $Id$
4444
*/
45-
public class LikeExistCacheEntryListenerTest
45+
class LikeExistCacheEntryListenerTest
4646
{
4747
private LikeManagerCacheHelper.LikeExistCacheEntryListener cacheEntryListener;
4848

xwiki-platform-core/xwiki-platform-like/xwiki-platform-like-api/src/test/java/org/xwiki/like/internal/LikeRightTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @version $Id$
3333
*/
34-
public class LikeRightTest
34+
class LikeRightTest
3535
{
3636
@Test
3737
void getters()

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/internal/AddressConverterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
* @since 6.2M1
3939
*/
4040
@ComponentTest
41-
public class AddressConverterTest
41+
class AddressConverterTest
4242
{
4343
@InjectMockComponents
4444
private AddressConverter converter;
4545

4646
@Test
47-
public void convert() throws Exception
47+
void convert() throws Exception
4848
{
4949
InternetAddress expected = new InternetAddress("John Doe(comment) <john1@doe.com>");
5050
assertEquals(expected, this.converter.convert(Address.class, "John Doe(comment) <john1@doe.com>"));

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/internal/AddressesConverterTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
* @since 6.1RC1
4040
*/
4141
@ComponentTest
42-
public class AddressesConverterTest
42+
class AddressesConverterTest
4343
{
4444
@InjectMockComponents
4545
private AddressesConverter converter;
4646

4747
@Test
48-
public void convert() throws Exception
48+
void convert() throws Exception
4949
{
5050
InternetAddress[] addresses = new InternetAddress[2];
5151
addresses[0] = new InternetAddress("John Doe(comment) <john1@doe.com>");
@@ -55,13 +55,13 @@ public void convert() throws Exception
5555
}
5656

5757
@Test
58-
public void convertWhenNull()
58+
void convertWhenNull()
5959
{
6060
assertNull(this.converter.convert(Address.class, null));
6161
}
6262

6363
@Test
64-
public void convertWhenTypeIsAlreadyAnAddressArray() throws Exception
64+
void convertWhenTypeIsAlreadyAnAddressArray() throws Exception
6565
{
6666
InternetAddress[] addresses = new InternetAddress[2];
6767
addresses[0] = new InternetAddress("John Doe(comment) <john1@doe.com>");
@@ -70,7 +70,7 @@ public void convertWhenTypeIsAlreadyAnAddressArray() throws Exception
7070
}
7171

7272
@Test
73-
public void convertWhenInvalid()
73+
void convertWhenInvalid()
7474
{
7575
Throwable exception = assertThrows(ConversionException.class, () -> {
7676
this.converter.convert(Address[].class, "invalid(");

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/internal/DefaultEmailAddressObfuscatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @since 12.4RC1
3535
*/
3636
@ComponentTest
37-
public class DefaultEmailAddressObfuscatorTest
37+
class DefaultEmailAddressObfuscatorTest
3838
{
3939
@InjectMockComponents
4040
private DefaultEmailAddressObfuscator obfuscator;

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/internal/InternetAddressConverterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
* @since 12.4RC1
3838
*/
3939
@ComponentTest
40-
public class InternetAddressConverterTest
40+
class InternetAddressConverterTest
4141
{
4242
@InjectMockComponents
4343
private InternetAddressConverter converter;
4444

4545
@Test
46-
public void convert() throws Exception
46+
void convert() throws Exception
4747
{
4848
InternetAddress address = new InternetAddress("John Doe(comment) <john1@doe.com>");
4949
assertEquals(address, this.converter.convert(InternetAddress.class, "John Doe(comment) <john1@doe.com>"));

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/internal/configuration/DefaultGeneralMailConfigurationTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* @since 12.4RC1
4141
*/
4242
@ComponentTest
43-
public class DefaultGeneralMailConfigurationTest
43+
class DefaultGeneralMailConfigurationTest
4444
{
4545
@InjectMockComponents
4646
private DefaultGeneralMailConfiguration configuration;
@@ -61,14 +61,14 @@ public class DefaultGeneralMailConfigurationTest
6161
private WikiDescriptorManager wikiDescriptorManager;
6262

6363
@BeforeEach
64-
public void setUp()
64+
void setUp()
6565
{
6666
when(this.wikiDescriptorManager.getCurrentWikiId()).thenReturn("mainwiki");
6767
when(this.wikiDescriptorManager.isMainWiki("mainwiki")).thenReturn(true);
6868
}
6969

7070
@Test
71-
public void shouldObfuscateWhenNotConfigured()
71+
void shouldObfuscateWhenNotConfigured()
7272
{
7373
// Simulate the default value returned by the call to getProperty() and not the value of the
7474
// "mail.general.obfuscateEmailAddresses" property which is supposed to be null here...
@@ -77,15 +77,15 @@ public void shouldObfuscateWhenNotConfigured()
7777
}
7878

7979
@Test
80-
public void shouldObfuscateWhenDefinedInXWikiProperties()
80+
void shouldObfuscateWhenDefinedInXWikiProperties()
8181
{
8282
when(this.xwikiPropertiesSource.getProperty("mail.general.obfuscate", false)).thenReturn(true);
8383

8484
assertTrue(this.configuration.shouldObfuscate());
8585
}
8686

8787
@Test
88-
public void shouldObfuscateFromMailConfigDocumentInMainWiki()
88+
void shouldObfuscateFromMailConfigDocumentInMainWiki()
8989
{
9090
when(this.currentWikiMailConfigDocumentSource.getProperty("obfuscate", Boolean.class))
9191
.thenReturn(true);
@@ -94,7 +94,7 @@ public void shouldObfuscateFromMailConfigDocumentInMainWiki()
9494
}
9595

9696
@Test
97-
public void shouldObfuscateFromMailConfigDocumentInSubwikiAndConfigInMainWiki()
97+
void shouldObfuscateFromMailConfigDocumentInSubwikiAndConfigInMainWiki()
9898
{
9999
when(this.wikiDescriptorManager.getCurrentWikiId()).thenReturn("subwiki");
100100
when(this.wikiDescriptorManager.isMainWiki("subwiki")).thenReturn(false);

xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-general/src/test/java/org/xwiki/mail/script/GeneralMailScriptServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* @since 12.4RC1
4040
*/
4141
@ComponentTest
42-
public class GeneralMailScriptServiceTest
42+
class GeneralMailScriptServiceTest
4343
{
4444
@InjectMockComponents
4545
private GeneralMailScriptService scriptService;

xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-remote/src/test/java/org/xwiki/observation/remote/RemoteEventDataTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
*
2929
* @version $Id$
3030
*/
31-
public class RemoteEventDataTest
31+
class RemoteEventDataTest
3232
{
3333
@Test
34-
public void constructor()
34+
void constructor()
3535
{
3636
RemoteEventData data = new RemoteEventData("event", "source", "data");
3737

0 commit comments

Comments
 (0)