Skip to content

Commit f5781d3

Browse files
authored
Merge pull request sscarduzio#106 from maitai/master
tests: swap arguments of assertEquals according to JUnit API
2 parents 4b61cbe + 7c6c3cb commit f5781d3

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

src/test/java/org/elasticsearch/rest/action/readonlyrest/acl/test/ACLTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public final void testAcceptExternalGet() throws Throwable {
8787
BlockExitResult res = acl.check(rc);
8888
assertTrue(res.isMatch());
8989
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
90-
assertEquals(res.getBlock().getName(), "8");
90+
assertEquals("8", res.getBlock().getName());
9191
}
9292

9393
@Test
@@ -96,7 +96,7 @@ public final void testAllowExternalOption() throws Throwable {
9696
BlockExitResult res = acl.check(rc);
9797
assertTrue(res.isMatch());
9898
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
99-
assertEquals(res.getBlock().getName(), "8");
99+
assertEquals("8", res.getBlock().getName());
100100
}
101101

102102
@Test
@@ -105,7 +105,7 @@ public final void testNetMask() throws Throwable {
105105
BlockExitResult res = acl.check(rc);
106106
assertTrue(res.isMatch());
107107
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
108-
assertEquals(res.getBlock().getName(), "4");
108+
assertEquals("4", res.getBlock().getName());
109109
}
110110

111111
// Methods + hosts
@@ -122,15 +122,15 @@ public final void testAcceptInternalGet() throws Throwable {
122122
BlockExitResult res = acl.check(rc);
123123
assertTrue(res.isMatch());
124124
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
125-
assertEquals(res.getBlock().getName(), "4");
125+
assertEquals("4", res.getBlock().getName());
126126
}
127127

128128
@Test
129129
public final void testAcceptInternalHead() throws Throwable {
130130
RequestContext rc = mockReq("/index1/_search?q=item.getName():fishingpole&size=200", "127.0.0.1", "", "", 0, Method.HEAD, null, null, null);
131131
BlockExitResult res = acl.check(rc);
132132
assertTrue(res.isMatch());
133-
assertEquals(res.getBlock().getName(), "4");
133+
assertEquals("4", res.getBlock().getName());
134134
}
135135

136136
// Body length
@@ -148,7 +148,7 @@ public final void testRejectExternalURIRegEx() throws Throwable {
148148
BlockExitResult res = acl.check(rc);
149149
assertTrue(res.isMatch());
150150
assertTrue(res.getBlock().getPolicy() == Block.Policy.FORBID);
151-
assertEquals(res.getBlock().getName(), "5");
151+
assertEquals("5", res.getBlock().getName());
152152
}
153153

154154
// API Keys
@@ -158,7 +158,7 @@ public final void testApiKey() throws Throwable {
158158
BlockExitResult res = acl.check(rc);
159159
assertTrue(res.isMatch());
160160
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
161-
assertEquals(res.getBlock().getName(), "3");
161+
assertEquals("3", res.getBlock().getName());
162162
}
163163

164164
// HTTP Basic Auth
@@ -169,7 +169,7 @@ public final void testHttpBasicAuth() throws Throwable {
169169
BlockExitResult res = acl.check(rc);
170170
assertTrue(res.isMatch());
171171
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
172-
assertEquals(res.getBlock().getName(), "2");
172+
assertEquals("2", res.getBlock().getName());
173173
}
174174
@Test
175175
public final void testSHA1HttpBasicAuth() throws Throwable {
@@ -178,7 +178,7 @@ public final void testSHA1HttpBasicAuth() throws Throwable {
178178
BlockExitResult res = acl.check(rc);
179179
assertTrue(res.isMatch());
180180
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
181-
assertEquals(res.getBlock().getName(), "15");
181+
assertEquals("15", res.getBlock().getName());
182182
}
183183

184184
@Test
@@ -187,7 +187,7 @@ public final void testXforwardedForHeader() throws Throwable {
187187
BlockExitResult res = acl.check(rc);
188188
assertTrue(res.isMatch());
189189
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
190-
assertEquals(res.getBlock().getName(), "1");
190+
assertEquals("1", res.getBlock().getName());
191191
}
192192

193193
// index
@@ -197,7 +197,7 @@ public final void testIndexIsolation() throws Throwable {
197197
BlockExitResult res = acl.check(rc);
198198
assertTrue(res.isMatch());
199199
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
200-
assertEquals(res.getBlock().getName(), "6");
200+
assertEquals("6", res.getBlock().getName());
201201
}
202202

203203
@Test
@@ -206,7 +206,7 @@ public final void testIndexWithWildcards() throws Throwable {
206206
BlockExitResult res = acl.check(rc);
207207
assertTrue(res.isMatch());
208208
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
209-
assertEquals(res.getBlock().getName(), "9");
209+
assertEquals("9", res.getBlock().getName());
210210
}
211211

212212
@Test
@@ -215,7 +215,7 @@ public final void testIndexWithWildcardsExactMatch() throws Throwable {
215215
BlockExitResult res = acl.check(rc);
216216
assertTrue(res.isMatch());
217217
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
218-
assertEquals(res.getBlock().getName(), "9");
218+
assertEquals("9", res.getBlock().getName());
219219
}
220220

221221
@Test
@@ -224,7 +224,7 @@ public final void testIndexWithPlus() throws Throwable {
224224
BlockExitResult res = acl.check(rc);
225225
assertTrue(res.isMatch());
226226
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
227-
assertEquals(res.getBlock().getName(), "10");
227+
assertEquals("10", res.getBlock().getName());
228228
}
229229

230230
@Test
@@ -240,7 +240,7 @@ public final void testAction() throws Throwable {
240240
BlockExitResult res = acl.check(rc);
241241
assertTrue(res.isMatch());
242242
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
243-
assertEquals(res.getBlock().getName(), "11");
243+
assertEquals("11", res.getBlock().getName());
244244
}
245245

246246
@Test
@@ -249,7 +249,7 @@ public final void testActionWildcard() throws Throwable {
249249
BlockExitResult res = acl.check(rc);
250250
assertTrue(res.isMatch());
251251
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
252-
assertEquals(res.getBlock().getName(), "12");
252+
assertEquals("12", res.getBlock().getName());
253253
}
254254

255255
@Test
@@ -258,7 +258,7 @@ public final void testActionWildcardExactMatch() throws Throwable {
258258
BlockExitResult res = acl.check(rc);
259259
assertTrue(res.isMatch());
260260
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
261-
assertEquals(res.getBlock().getName(), "12");
261+
assertEquals("12", res.getBlock().getName());
262262
}
263263

264264
@Test
@@ -267,7 +267,7 @@ public final void testNoIndex() throws Throwable {
267267
BlockExitResult res = acl.check(rc);
268268
assertTrue(res.isMatch());
269269
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
270-
assertEquals(res.getBlock().getName(), "13");
270+
assertEquals("13", res.getBlock().getName());
271271
}
272272

273273
@Test
@@ -276,7 +276,7 @@ public final void testAllowMultiIndex() throws Throwable {
276276
BlockExitResult res = acl.check(rc);
277277
assertTrue(res.isMatch());
278278
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
279-
assertEquals(res.getBlock().getName(), "14");
279+
assertEquals("14", res.getBlock().getName());
280280
}
281281

282282
@Test
@@ -286,4 +286,4 @@ public final void testForbidMultiIndexWithExtraIndex() throws Throwable {
286286
assertFalse(res.isMatch());
287287
}
288288

289-
}
289+
}

src/test/java/org/elasticsearch/rest/action/readonlyrest/acl/test/KibanaACLTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final void testKibanaROClusterAction() throws Throwable {
2525
BlockExitResult res = acl.check(rc);
2626
assertTrue(res.isMatch());
2727
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
28-
assertEquals(res.getBlock().getName(), "1");
28+
assertEquals("1", res.getBlock().getName());
2929
}
3030

3131
@Test
@@ -34,15 +34,15 @@ public final void testKibanaROreadAction() throws Throwable {
3434
BlockExitResult res = acl.check(rc);
3535
assertTrue(res.isMatch());
3636
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
37-
assertEquals(res.getBlock().getName(), "1");
37+
assertEquals("1", res.getBlock().getName());
3838
}
3939
@Test
4040
public final void testKibanaROwriteKibanaDevNull() throws Throwable {
4141
RequestContext rc = ACLTest.mockReq("xyz", "1.1.1.1", "", "", 0, null, null, new String[]{".kibana-devnull"}, "indices:data/write/update");
4242
BlockExitResult res = acl.check(rc);
4343
assertTrue(res.isMatch());
4444
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
45-
assertEquals(res.getBlock().getName(), "1");
45+
assertEquals("1", res.getBlock().getName());
4646
}
4747

4848
@Test
@@ -58,31 +58,31 @@ public final void testKibanaRWreadAction() throws Throwable {
5858
BlockExitResult res = acl.check(rc);
5959
assertTrue(res.isMatch());
6060
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
61-
assertEquals(res.getBlock().getName(), "2");
61+
assertEquals("2", res.getBlock().getName());
6262
}
6363
@Test
6464
public final void testKibanaRWwriteAction() throws Throwable {
6565
RequestContext rc = ACLTest.mockReq("xyz", "2.2.2.2", "", "", 0, null, null, new String[]{"random-idx"}, "indices:data/write/update");
6666
BlockExitResult res = acl.check(rc);
6767
assertTrue(res.isMatch());
6868
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
69-
assertEquals(res.getBlock().getName(), "2");
69+
assertEquals("2", res.getBlock().getName());
7070
}
7171
@Test
7272
public final void testKibanaRWClusterAction() throws Throwable {
7373
RequestContext rc = ACLTest.mockReq("xyz", "2.2.2.2", "", "", 0, null, null, new String[]{"random-idx"}, "cluster:monitor/health");
7474
BlockExitResult res = acl.check(rc);
7575
assertTrue(res.isMatch());
7676
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
77-
assertEquals(res.getBlock().getName(), "2");
77+
assertEquals("2", res.getBlock().getName());
7878
}
7979
@Test
8080
public final void testKibanaRWClusterActionOnKibanaIdx() throws Throwable {
8181
RequestContext rc = ACLTest.mockReq("xyz", "2.2.2.2", "", "", 0, null, null, new String[]{".kibana"}, "cluster:monitor/health");
8282
BlockExitResult res = acl.check(rc);
8383
assertTrue(res.isMatch());
8484
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
85-
assertEquals(res.getBlock().getName(), "2");
85+
assertEquals("2", res.getBlock().getName());
8686
}
8787

8888
@Test
@@ -98,7 +98,7 @@ public final void testKibanaRWwriteDashboard() throws Throwable {
9898
BlockExitResult res = acl.check(rc);
9999
assertTrue(res.isMatch());
100100
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
101-
assertEquals(res.getBlock().getName(), "2");
101+
assertEquals("2", res.getBlock().getName());
102102
}
103103

104104
@Test
@@ -107,7 +107,7 @@ public final void testKibanaR0PlusWriteDashboard() throws Throwable {
107107
BlockExitResult res = acl.check(rc);
108108
assertTrue(res.isMatch());
109109
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
110-
assertEquals(res.getBlock().getName(), "3");
110+
assertEquals("3", res.getBlock().getName());
111111
}
112112

113113
@Test
@@ -116,7 +116,7 @@ public final void testKibanaR0PlusWriteKibanaDevnull() throws Throwable {
116116
BlockExitResult res = acl.check(rc);
117117
assertTrue(res.isMatch());
118118
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
119-
assertEquals(res.getBlock().getName(), "3");
119+
assertEquals("3", res.getBlock().getName());
120120
}
121121

122122
@Test
@@ -125,7 +125,7 @@ public final void testKibanaR0WriteKibanaDevnull() throws Throwable {
125125
BlockExitResult res = acl.check(rc);
126126
assertTrue(res.isMatch());
127127
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
128-
assertEquals(res.getBlock().getName(), "3");
128+
assertEquals("3", res.getBlock().getName());
129129
}
130130

131131
@Test
@@ -134,7 +134,7 @@ public final void testKibanaR0WriteDashboardCustomKibanaIdx() throws Throwable {
134134
BlockExitResult res = acl.check(rc);
135135
assertTrue(res.isMatch());
136136
assertTrue(res.getBlock().getPolicy() == Block.Policy.ALLOW);
137-
assertEquals(res.getBlock().getName(), "4");
137+
assertEquals("4", res.getBlock().getName());
138138
}
139139

140-
}
140+
}

0 commit comments

Comments
 (0)