Skip to content

Commit a1e26f7

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 in xwiki-platform-oldcore, as reported by SonarCloud rule java:S5786. Behaviour-preserving, test code only.
1 parent 311415d commit a1e26f7

32 files changed

Lines changed: 91 additions & 91 deletions

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/api/XWikiTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
*/
6464
@OldcoreTest
6565
@ReferenceComponentList
66-
public class XWikiTest
66+
class XWikiTest
6767
{
6868
private static final DocumentReference DOCUMENT_REFERENCE = new DocumentReference("xwiki", "MilkyWay", "Fidis");
6969

@@ -77,7 +77,7 @@ public class XWikiTest
7777
private XWiki apiXWiki;
7878

7979
@BeforeEach
80-
public void setup(MockitoOldcore mockitoOldcore) throws XWikiException
80+
void setup(MockitoOldcore mockitoOldcore) throws XWikiException
8181
{
8282
XWikiContext xWikiContext = mockitoOldcore.getXWikiContext();
8383
this.apiXWiki = new XWiki(mockitoOldcore.getSpyXWiki(), xWikiContext);
@@ -98,7 +98,7 @@ public void setup(MockitoOldcore mockitoOldcore) throws XWikiException
9898
}
9999

100100
@Test
101-
public void authorIsntChangedAfterDocumentCopy() throws XWikiException
101+
void authorIsntChangedAfterDocumentCopy() throws XWikiException
102102
{
103103
String copyName = "Lyre";
104104
this.apiXWiki.copyDocument("MilkyWay.Fidis", copyName);
@@ -108,7 +108,7 @@ public void authorIsntChangedAfterDocumentCopy() throws XWikiException
108108
}
109109

110110
@Test
111-
public void creatorIsntChangedAfterDocumentCopy() throws XWikiException
111+
void creatorIsntChangedAfterDocumentCopy() throws XWikiException
112112
{
113113
String copyName = "Sirius";
114114
this.apiXWiki.copyDocument("MilkyWay.Fidis", copyName);
@@ -118,7 +118,7 @@ public void creatorIsntChangedAfterDocumentCopy() throws XWikiException
118118
}
119119

120120
@Test
121-
public void creationDateAfterDocumentCopy() throws XWikiException
121+
void creationDateAfterDocumentCopy() throws XWikiException
122122
{
123123
String copyName = this.apiDocument.getDocumentReference().getName() + "Copy";
124124
long startTime = (Calendar.getInstance().getTimeInMillis() / 1000) * 1000;
@@ -130,7 +130,7 @@ public void creationDateAfterDocumentCopy() throws XWikiException
130130
}
131131

132132
@Test
133-
public void getAvailableRendererSyntax(MockitoComponentManager componentManager) throws Exception
133+
void getAvailableRendererSyntax(MockitoComponentManager componentManager) throws Exception
134134
{
135135
PrintRendererFactory factory1 = componentManager.registerMockComponent(PrintRendererFactory.class,
136136
Syntax.PLAIN_1_0.toIdString());

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/doc/XWikiDocumentMockitoTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
@OldcoreTest
112112
@ReferenceComponentList
113113
@XWikiDocumentFilterUtilsComponentList
114-
public class XWikiDocumentMockitoTest
114+
class XWikiDocumentMockitoTest
115115
{
116116
private static final String DOCWIKI = "wiki";
117117

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/DefaultXWikiStubContextProviderTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* @version $Id$
5454
*/
5555
@OldcoreTest
56-
public class DefaultXWikiStubContextProviderTest
56+
class DefaultXWikiStubContextProviderTest
5757
{
5858
@MockComponent
5959
private Execution execution;
@@ -67,7 +67,7 @@ public class DefaultXWikiStubContextProviderTest
6767
private XWikiURLFactoryService urlFactoryService = mock(XWikiURLFactoryService.class);
6868

6969
@BeforeEach
70-
public void beforeEach()
70+
void beforeEach()
7171
{
7272
this.oldcore.getXWikiContext().setRequest(new XWikiServletRequestStub());
7373
this.oldcore.getXWikiContext().setResponse(new XWikiServletResponseStub());
@@ -80,7 +80,7 @@ public void beforeEach()
8080
}
8181

8282
@Test
83-
public void createStubContext()
83+
void createStubContext()
8484
{
8585
XWikiContext xcontext1 = this.provider.createStubContext();
8686
XWikiContext xcontext2 = this.provider.createStubContext();
@@ -92,7 +92,7 @@ public void createStubContext()
9292
}
9393

9494
@Test
95-
public void createStubContextWithLoopProtection()
95+
void createStubContextWithLoopProtection()
9696
{
9797
XWikiContext[] subContext = new XWikiContext[1];
9898

@@ -115,7 +115,7 @@ public XWikiURLFactory answer(InvocationOnMock invocation) throws Throwable
115115
}
116116

117117
@Test
118-
public void createStubContextWithNoExecutionContext()
118+
void createStubContextWithNoExecutionContext()
119119
{
120120
when(this.execution.getContext()).thenReturn(null);
121121

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/XWikiStubContextInitializerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* @version $Id$
3838
*/
3939
@OldcoreTest
40-
public class XWikiStubContextInitializerTest
40+
class XWikiStubContextInitializerTest
4141
{
4242
@MockComponent
4343
private XWikiStubContextProvider stubContextProvider;
@@ -46,7 +46,7 @@ public class XWikiStubContextInitializerTest
4646
private XWikiStubContextInitializer initializer;
4747

4848
@Test
49-
public void testWithAndWithoutXWikiContext() throws Exception
49+
void testWithAndWithoutXWikiContext() throws Exception
5050
{
5151
XWikiContext stubContext = new XWikiContext();
5252

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/context/XWikiContextContextStoreTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class XWikiContextContextStoreTest
102102
private URL requestwikiURL;
103103

104104
@BeforeEach
105-
public void beforeEach() throws WikiManagerException, ComponentLookupException, MalformedURLException
105+
void beforeEach() throws WikiManagerException, ComponentLookupException, MalformedURLException
106106
{
107107
this.descriptor = new WikiDescriptor(WIKI, WIKI);
108108
this.descriptor.setMainPageReference(new DocumentReference(this.descriptor.getId(), "Space", "MainPage"));

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/doc/BaseObjectsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*
3636
* @version $Id$
3737
*/
38-
public class BaseObjectsTest
38+
class BaseObjectsTest
3939
{
4040
private static final class TestBaseObject extends BaseObject
4141
{

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/filter/output/DocumentInstanceOutputFilterStreamTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void documentwithattachmentwithoutcontent() throws FilterException, XWikiExcepti
454454
}
455455

456456
@Test
457-
public void documentwithunknownClassproperty() throws FilterException, XWikiException
457+
void documentwithunknownClassproperty() throws FilterException, XWikiException
458458
{
459459
DocumentInstanceOutputProperties outputProperties = new DocumentInstanceOutputProperties();
460460

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/model/reference/CurrentEntityReferenceProviderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
*/
5050
@OldcoreTest
5151
@ComponentList(DefaultEntityReferenceProvider.class)
52-
public class CurrentEntityReferenceProviderTest
52+
class CurrentEntityReferenceProviderTest
5353
{
5454
private static final String CONTEXT_WIKI = "contextwiki";
5555

@@ -120,7 +120,7 @@ public class CurrentEntityReferenceProviderTest
120120
private CurrentEntityReferenceProvider provider;
121121

122122
@BeforeEach
123-
public void beforeEach()
123+
void beforeEach()
124124
{
125125
this.mockitoOldcore.getXWikiContext().setWikiId(null);
126126

@@ -143,7 +143,7 @@ public void beforeEach()
143143
}
144144

145145
@Test
146-
public void getDefaultReferenceWithoutContextDocument()
146+
void getDefaultReferenceWithoutContextDocument()
147147
{
148148
assertEquals(DEFAULT_WIKI_REFERENCE, this.provider.getDefaultReference(EntityType.WIKI));
149149

@@ -163,7 +163,7 @@ public void getDefaultReferenceWithoutContextDocument()
163163
}
164164

165165
@Test
166-
public void getDefaultReferenceWithContextDocument() throws IllegalAccessException
166+
void getDefaultReferenceWithContextDocument() throws IllegalAccessException
167167
{
168168
this.mockitoOldcore.getXWikiContext().setWikiId(CONTEXT_WIKI);
169169

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/model/reference/CurrentReferenceEntityReferenceResolverTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
*/
4949
@ComponentTest
5050
@ComponentList(DefaultEntityReferenceProvider.class)
51-
public class CurrentReferenceEntityReferenceResolverTest
51+
class CurrentReferenceEntityReferenceResolverTest
5252
{
5353
private static final String CURRENT_WIKI = "currentwiki";
5454

@@ -102,7 +102,7 @@ public class CurrentReferenceEntityReferenceResolverTest
102102
private CurrentReferenceEntityReferenceResolver resolver;
103103

104104
@BeforeEach
105-
public void beforeEach() throws Exception
105+
void beforeEach() throws Exception
106106
{
107107
when(this.currentProvider.getDefaultReference(EntityType.WIKI)).thenReturn(CURRENT_WIKI_REFERENCE);
108108
when(this.currentProvider.getDefaultReference(EntityType.SPACE)).thenReturn(CURRENT_SPACE_REFERENCE);
@@ -128,7 +128,7 @@ public void beforeEach() throws Exception
128128
}
129129

130130
@Test
131-
public void testResolveAttachmentReferenceWhenMissingParents()
131+
void testResolveAttachmentReferenceWhenMissingParents()
132132
{
133133
EntityReference reference =
134134
resolver.resolve(new EntityReference("filename", EntityType.ATTACHMENT), EntityType.ATTACHMENT);
@@ -142,7 +142,7 @@ public void testResolveAttachmentReferenceWhenMissingParents()
142142
}
143143

144144
@Test
145-
public void resolvePageReferenceWhenTypeIsDocument()
145+
void resolvePageReferenceWhenTypeIsDocument()
146146
{
147147
EntityReference reference =
148148
this.resolver.resolve(new EntityReference("document", EntityType.DOCUMENT), EntityType.PAGE);
@@ -155,7 +155,7 @@ public void resolvePageReferenceWhenTypeIsDocument()
155155
}
156156

157157
@Test
158-
public void resolvePageReferenceWhenTypeIsSpace()
158+
void resolvePageReferenceWhenTypeIsSpace()
159159
{
160160
EntityReference reference =
161161
this.resolver.resolve(new EntityReference("space", EntityType.SPACE), EntityType.PAGE);
@@ -164,7 +164,7 @@ public void resolvePageReferenceWhenTypeIsSpace()
164164
}
165165

166166
@Test
167-
public void resolveDocumentReferenceWhenTypeIsPage()
167+
void resolveDocumentReferenceWhenTypeIsPage()
168168
{
169169
EntityReference reference =
170170
this.resolver.resolve(new EntityReference("page", EntityType.PAGE), EntityType.DOCUMENT);
@@ -179,7 +179,7 @@ public void resolveDocumentReferenceWhenTypeIsPage()
179179
}
180180

181181
@Test
182-
public void resolveSpaceReferenceWhenTypeIsPage()
182+
void resolveSpaceReferenceWhenTypeIsPage()
183183
{
184184
EntityReference reference =
185185
this.resolver.resolve(new EntityReference("page", EntityType.PAGE), EntityType.SPACE);

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/model/reference/CurrentStringEntityReferenceResolverTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
@ComponentList(value = { CurrentEntityReferenceProvider.class, CurrentStringEntityReferenceResolver.class,
5151
DefaultModelConfiguration.class, DefaultSymbolScheme.class, ExplicitReferencePageReferenceResolver.class,
5252
ExplicitReferenceEntityReferenceResolver.class })
53-
public class CurrentStringEntityReferenceResolverTest
53+
class CurrentStringEntityReferenceResolverTest
5454
{
5555
@InjectMockitoOldcore
5656
private MockitoOldcore oldcore;
@@ -71,13 +71,13 @@ public class CurrentStringEntityReferenceResolverTest
7171
private CurrentStringEntityReferenceResolver resolver;
7272

7373
@BeforeEach
74-
public void beforeEach() throws Exception
74+
void beforeEach() throws Exception
7575
{
7676
this.oldcore.getXWikiContext().setWikiId(CURRENT_WIKI);
7777
}
7878

7979
@Test
80-
public void testResolveDocumentReferenceWhenNoContextWiki() throws Exception
80+
void testResolveDocumentReferenceWhenNoContextWiki() throws Exception
8181
{
8282
this.oldcore.getXWikiContext().setWikiId(null);
8383

@@ -89,7 +89,7 @@ public void testResolveDocumentReferenceWhenNoContextWiki() throws Exception
8989
}
9090

9191
@Test
92-
public void testResolveDocumentReferenceWhenNoContextDocument() throws Exception
92+
void testResolveDocumentReferenceWhenNoContextDocument() throws Exception
9393
{
9494
this.oldcore.getXWikiContext().setWikiId(null);
9595
this.oldcore.getXWikiContext().setDoc(null);
@@ -102,7 +102,7 @@ public void testResolveDocumentReferenceWhenNoContextDocument() throws Exception
102102
}
103103

104104
@Test
105-
public void testResolveDocumentReferenceWhenContextDocument() throws Exception
105+
void testResolveDocumentReferenceWhenContextDocument() throws Exception
106106
{
107107
this.oldcore.getXWikiContext()
108108
.setDoc(new XWikiDocument(new DocumentReference(CURRENT_WIKI, CURRENTDOC_SPACE, CURRENTDOC_DOCUMENT)));
@@ -115,7 +115,7 @@ public void testResolveDocumentReferenceWhenContextDocument() throws Exception
115115
}
116116

117117
@Test
118-
public void testResolveAttachmentReference() throws Exception
118+
void testResolveAttachmentReference() throws Exception
119119
{
120120
this.oldcore.getXWikiContext()
121121
.setDoc(new XWikiDocument(new DocumentReference(CURRENT_WIKI, CURRENTDOC_SPACE, CURRENTDOC_DOCUMENT)));
@@ -129,7 +129,7 @@ public void testResolveAttachmentReference() throws Exception
129129
}
130130

131131
@Test
132-
public void testResolveAttachmentReferenceWhenMissingParentsAndNoContextDocument()
132+
void testResolveAttachmentReferenceWhenMissingParentsAndNoContextDocument()
133133
{
134134
EntityReference reference = resolver.resolve("filename", EntityType.ATTACHMENT);
135135

@@ -142,7 +142,7 @@ public void testResolveAttachmentReferenceWhenMissingParentsAndNoContextDocument
142142
}
143143

144144
@Test
145-
public void testResolveAttachmentReferenceWhenMissingParentsAndContextDocument()
145+
void testResolveAttachmentReferenceWhenMissingParentsAndContextDocument()
146146
{
147147
this.oldcore.getXWikiContext()
148148
.setDoc(new XWikiDocument(new DocumentReference("docwiki", CURRENT_SPACE, CURRENT_DOCUMENT)));
@@ -158,7 +158,7 @@ public void testResolveAttachmentReferenceWhenMissingParentsAndContextDocument()
158158
}
159159

160160
@Test
161-
public void testResolvePageReferenceKeywords() throws Exception
161+
void testResolvePageReferenceKeywords() throws Exception
162162
{
163163
XWikiDocument document = new XWikiDocument(new DocumentReference("docwiki", CURRENT_SPACE, CURRENT_PAGE));
164164
FieldUtils.writeDeclaredField(document, "pageReferenceCache",

0 commit comments

Comments
 (0)