Skip to content

Commit b09da11

Browse files
committed
[testsuite] auto fix IntelliJ inspections
1 parent 22fef81 commit b09da11

File tree

1 file changed

+52
-55
lines changed

1 file changed

+52
-55
lines changed

exist-core/src/test/java/org/exist/xquery/XQueryFunctionsTest.java

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,27 @@
2121
*/
2222
package org.exist.xquery;
2323

24-
import java.net.URISyntaxException;
25-
import java.nio.file.Path;
26-
import java.nio.file.Paths;
27-
import java.text.SimpleDateFormat;
28-
import java.util.Date;
29-
import java.util.Locale;
30-
import java.util.Optional;
31-
3224
import com.googlecode.junittoolbox.ParallelRunner;
3325
import org.exist.test.ExistXmldbEmbeddedServer;
34-
import org.exist.util.ConfigurationHelper;
35-
import org.exist.util.FileUtils;
3626
import org.exist.xmldb.XmldbURI;
37-
import org.junit.*;
27+
import org.junit.ClassRule;
28+
import org.junit.Ignore;
29+
import org.junit.Test;
3830
import org.junit.runner.RunWith;
3931
import org.xmldb.api.base.Collection;
4032
import org.xmldb.api.base.ResourceSet;
4133
import org.xmldb.api.base.XMLDBException;
4234
import org.xmldb.api.modules.BinaryResource;
4335
import org.xmldb.api.modules.CollectionManagementService;
4436

45-
import static org.junit.Assert.assertEquals;
46-
import static org.junit.Assert.assertNotNull;
47-
import static org.junit.Assert.assertTrue;
37+
import java.net.URISyntaxException;
38+
import java.nio.file.Path;
39+
import java.nio.file.Paths;
40+
import java.text.SimpleDateFormat;
41+
import java.util.Date;
42+
import java.util.Locale;
43+
44+
import static org.junit.Assert.*;
4845

4946
/**
5047
* Tests for various standard XQuery functions
@@ -70,7 +67,7 @@ public class XQueryFunctionsTest {
7067
private final static String ROOT_COLLECTION_URI = "xmldb:exist:///db";
7168

7269
@Test
73-
public void arguments() throws XPathException, XMLDBException {
70+
public void arguments() throws XMLDBException {
7471
ResourceSet result = existEmbeddedServer.executeQuery("declare function local:testAnyURI($uri as xs:string) as xs:string { " +
7572
"concat('Successfully processed as xs:string : ',$uri) " +
7673
"}; " +
@@ -94,7 +91,7 @@ public void arguments() throws XPathException, XMLDBException {
9491
* with the rounding value typed xs:integer
9592
*/
9693
@Test
97-
public void roundHtE_INTEGER() throws XPathException, XMLDBException {
94+
public void roundHtE_INTEGER() throws XMLDBException {
9895
String query = "fn:round-half-to-even( xs:integer('1'), 0 )";
9996
ResourceSet result = existEmbeddedServer.executeQuery(query);
10097
String r = (String) result.getResource(0).getContent();
@@ -116,7 +113,7 @@ public void roundHtE_INTEGER() throws XPathException, XMLDBException {
116113
* with the rounding value typed xs:double
117114
*/
118115
@Test
119-
public void roundHtE_DOUBLE() throws XPathException, XMLDBException {
116+
public void roundHtE_DOUBLE() throws XMLDBException {
120117
/* List of Values to test with Rounding */
121118
String[] testvalues =
122119
{"0.5", "1.5", "2.5", "3.567812E+3", "4.7564E-3", "35612.25"};
@@ -137,7 +134,7 @@ public void roundHtE_DOUBLE() throws XPathException, XMLDBException {
137134
* Tests the XQuery-XPath function fn:tokenize()
138135
*/
139136
@Test
140-
public void tokenize() throws XPathException, XMLDBException {
137+
public void tokenize() throws XMLDBException {
141138
ResourceSet result = existEmbeddedServer.executeQuery("count ( tokenize('a/b' , '/') )");
142139
String r = (String) result.getResource(0).getContent();
143140
assertEquals("2", r);
@@ -171,7 +168,7 @@ public void tokenize() throws XPathException, XMLDBException {
171168
}
172169

173170
@Test
174-
public void deepEqual() throws XPathException, XMLDBException {
171+
public void deepEqual() throws XMLDBException {
175172
ResourceSet result = existEmbeddedServer.executeQuery(
176173
"let $res := ('a', 'b')" +
177174
"let $reference := ('a', 'b')" +
@@ -196,7 +193,7 @@ public void compare() throws XPathException, XMLDBException {
196193
}
197194

198195
@Test
199-
public void distinctValues() throws XPathException, XMLDBException {
196+
public void distinctValues() throws XMLDBException {
200197
ResourceSet result = existEmbeddedServer.executeQuery("declare variable $c { distinct-values(('a', 'a')) }; $c");
201198
String r = (String) result.getResource(0).getContent();
202199
assertEquals("a", r);
@@ -215,7 +212,7 @@ public void distinctValues() throws XPathException, XMLDBException {
215212
}
216213

217214
@Test
218-
public void sum() throws XPathException, XMLDBException {
215+
public void sum() throws XMLDBException {
219216
ResourceSet result = existEmbeddedServer.executeQuery("declare variable $c { sum((1, 2)) }; $c");
220217
String r = (String) result.getResource(0).getContent();
221218
assertEquals("3", r);
@@ -231,7 +228,7 @@ public void sum() throws XPathException, XMLDBException {
231228
}
232229

233230
@Test
234-
public void avg() throws XPathException, XMLDBException {
231+
public void avg() throws XMLDBException {
235232
ResourceSet result = existEmbeddedServer.executeQuery("avg((2, 2))");
236233
String r = (String) result.getResource(0).getContent();
237234
assertEquals("2", r);
@@ -257,7 +254,7 @@ public void avg() throws XPathException, XMLDBException {
257254
} catch (XMLDBException e) {
258255
message = e.getMessage();
259256
}
260-
assertTrue(message.indexOf("FORG0006") > -1);
257+
assertTrue(message.contains("FORG0006"));
261258

262259
result = existEmbeddedServer.executeQuery("avg(())");
263260
assertEquals(0, result.getSize());
@@ -298,7 +295,7 @@ public void min() throws XPathException, XMLDBException {
298295
} catch (XMLDBException e) {
299296
message = e.getMessage();
300297
}
301-
assertTrue(message.indexOf("FORG0006") > -1);
298+
assertTrue(message.contains("FORG0006"));
302299

303300
try {
304301
message = "";
@@ -307,7 +304,7 @@ public void min() throws XPathException, XMLDBException {
307304
message = e.getMessage();
308305
}
309306
//depends whether we have strict type checking or not
310-
assertTrue(message.indexOf("XPTY0004") > -1 | message.indexOf("FORG0001") > -1 | message.indexOf("FOCH0002") > -1);
307+
assertTrue(message.contains("XPTY0004") | message.contains("FORG0001") | message.contains("FOCH0002"));
311308
}
312309

313310
public void max() throws XPathException, XMLDBException {
@@ -336,7 +333,7 @@ public void max() throws XPathException, XMLDBException {
336333
} catch (XMLDBException e) {
337334
message = e.getMessage();
338335
}
339-
assertTrue(message.indexOf("FORG0006") > -1);
336+
assertTrue(message.contains("FORG0006"));
340337

341338
try {
342339
message = "";
@@ -345,11 +342,11 @@ public void max() throws XPathException, XMLDBException {
345342
message = e.getMessage();
346343
}
347344
//depends whether we have strict type checking or not
348-
assertTrue(message.indexOf("XPTY0004") > -1 | message.indexOf("FORG0001") > -1 | message.indexOf("FOCH0002") > -1);
345+
assertTrue(message.contains("XPTY0004") | message.contains("FORG0001") | message.contains("FOCH0002"));
349346
}
350347

351348
@Test
352-
public void exclusiveLock() throws XPathException, XMLDBException {
349+
public void exclusiveLock() throws XMLDBException {
353350
String query = "let $query1 := (<a/>)\n" +
354351
"let $query2 := (2, 3)\n" +
355352
"let $a := util:exclusive-lock(//*,($query1, $query2))\n" +
@@ -398,17 +395,17 @@ public void exclusiveLock() throws XPathException, XMLDBException {
398395

399396
@Ignore
400397
@Test
401-
public void utilEval1() throws XPathException, XMLDBException {
398+
public void utilEval1() throws XMLDBException {
402399
String query = "<a><b/></a>/util:eval('*')";
403400
ResourceSet result = existEmbeddedServer.executeQuery(query);
404401
assertEquals(1, result.getSize());
405402
}
406403

407404
/**
408-
* @see http://sourceforge.net/tracker/index.php?func=detail&aid=1629363&group_id=17691&atid=117691
405+
* @see {http://sourceforge.net/tracker/index.php?func=detail&aid=1629363&group_id=17691&atid=117691}
409406
*/
410407
@Test
411-
public void utilEval2() throws XPathException, XMLDBException {
408+
public void utilEval2() throws XMLDBException {
412409
String query = "let $context := <item/> " +
413410
"return util:eval(\"<result>{$context}</result>\")";
414411
// TODO check result
@@ -417,7 +414,7 @@ public void utilEval2() throws XPathException, XMLDBException {
417414
}
418415

419416
@Test
420-
public void utilEvalForFunction() throws XPathException, XMLDBException {
417+
public void utilEvalForFunction() throws XMLDBException {
421418

422419
String query = "declare function local:home()\n"
423420
+ "{\n"
@@ -430,7 +427,7 @@ public void utilEvalForFunction() throws XPathException, XMLDBException {
430427
}
431428

432429
@Test
433-
public void sharedLock() throws XPathException, XMLDBException {
430+
public void sharedLock() throws XMLDBException {
434431
String query = "let $query1 := (<a/>)\n" +
435432
"let $query2 := (2, 3)\n" +
436433
"let $a := util:shared-lock(//*,($query1, $query2))\n" +
@@ -560,7 +557,7 @@ public void escapeHTMLURI() throws XMLDBException {
560557
}
561558

562559
@Test
563-
public void localName() throws XPathException, XMLDBException {
560+
public void localName() throws XMLDBException {
564561
final ResourceSet result = existEmbeddedServer.executeQuery(
565562
"let $a := <a><b></b></a>" +
566563
"return fn:local-name($a)");
@@ -569,31 +566,31 @@ public void localName() throws XPathException, XMLDBException {
569566
}
570567

571568
@Test
572-
public void localName_empty() throws XPathException, XMLDBException {
569+
public void localName_empty() throws XMLDBException {
573570
final ResourceSet result = existEmbeddedServer.executeQuery(
574571
"fn:local-name(())");
575572
final String r = (String) result.getResource(0).getContent();
576573
assertEquals("", r);
577574
}
578575

579576
@Test
580-
public void localName_emptyElement() throws XPathException, XMLDBException {
577+
public void localName_emptyElement() throws XMLDBException {
581578
final ResourceSet result = existEmbeddedServer.executeQuery(
582579
"<a>b</a>/fn:local-name(c)");
583580
final String r = (String) result.getResource(0).getContent();
584581
assertEquals("", r);
585582
}
586583

587584
@Test
588-
public void localName_emptyText() throws XPathException, XMLDBException {
585+
public void localName_emptyText() throws XMLDBException {
589586
final ResourceSet result = existEmbeddedServer.executeQuery(
590587
"<a>b</a>/fn:local-name(text())");
591588
final String r = (String) result.getResource(0).getContent();
592589
assertEquals("", r);
593590
}
594591

595592
@Test
596-
public void localName_contextItem() throws XPathException, XMLDBException {
593+
public void localName_contextItem() throws XMLDBException {
597594
final ResourceSet result = existEmbeddedServer.executeQuery(
598595
"let $a := <a><b/></a>" +
599596
"return $a/b/fn:local-name()");
@@ -602,7 +599,7 @@ public void localName_contextItem() throws XPathException, XMLDBException {
602599
}
603600

604601
@Test
605-
public void localName_contextItem_empty() throws XPathException, XMLDBException {
602+
public void localName_contextItem_empty() throws XMLDBException {
606603
final ResourceSet result = existEmbeddedServer.executeQuery(
607604
"let $a := <a><b/></a>" +
608605
"return $a/b/c/fn:local-name()");
@@ -619,31 +616,31 @@ public void name() throws XPathException, XMLDBException {
619616
}
620617

621618
@Test
622-
public void name_empty() throws XPathException, XMLDBException {
619+
public void name_empty() throws XMLDBException {
623620
final ResourceSet result = existEmbeddedServer.executeQuery(
624621
"fn:name(())");
625622
final String r = (String) result.getResource(0).getContent();
626623
assertEquals("", r);
627624
}
628625

629626
@Test
630-
public void name_emptyElement() throws XPathException, XMLDBException {
627+
public void name_emptyElement() throws XMLDBException {
631628
final ResourceSet result = existEmbeddedServer.executeQuery(
632629
"<a>b</a>/fn:name(c)");
633630
final String r = (String) result.getResource(0).getContent();
634631
assertEquals("", r);
635632
}
636633

637634
@Test
638-
public void name_emptyText() throws XPathException, XMLDBException {
635+
public void name_emptyText() throws XMLDBException {
639636
final ResourceSet result = existEmbeddedServer.executeQuery(
640637
"<a>b</a>/fn:local-name(text())");
641638
final String r = (String) result.getResource(0).getContent();
642639
assertEquals("", r);
643640
}
644641

645642
@Test
646-
public void name_contextItem() throws XPathException, XMLDBException {
643+
public void name_contextItem() throws XMLDBException {
647644
final ResourceSet result = existEmbeddedServer.executeQuery(
648645
"let $a := <a><b/></a>" +
649646
"return $a/b/fn:name()");
@@ -652,15 +649,15 @@ public void name_contextItem() throws XPathException, XMLDBException {
652649
}
653650

654651
@Test
655-
public void name_contextItem_empty() throws XPathException, XMLDBException {
652+
public void name_contextItem_empty() throws XMLDBException {
656653
final ResourceSet result = existEmbeddedServer.executeQuery(
657654
"let $a := <a><b/></a>" +
658655
"return $a/b/c/fn:name()");
659656
assertEquals(0, result.getSize());
660657
}
661658

662659
@Test
663-
public void dateTimeConstructor() throws XPathException, XMLDBException {
660+
public void dateTimeConstructor() throws XMLDBException {
664661
ResourceSet result = existEmbeddedServer.executeQuery(
665662
"let $date := xs:date('2007-05-02+02:00') " +
666663
"return dateTime($date, xs:time('15:12:52.421+02:00'))"
@@ -670,7 +667,7 @@ public void dateTimeConstructor() throws XPathException, XMLDBException {
670667
}
671668

672669
@Test
673-
public void currentDateTime() throws XPathException, XMLDBException {
670+
public void currentDateTime() throws XMLDBException {
674671
//Do not use this test around midnight on the last day of a month ;-)
675672
ResourceSet result = existEmbeddedServer.executeQuery(
676673
"('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', " +
@@ -691,7 +688,7 @@ public void currentDateTime() throws XPathException, XMLDBException {
691688
/**
692689
* Bugfix 3070
693690
*
694-
* @see http://svn.sourceforge.net/exist/?rev=3070&view=rev
691+
* @see {http://svn.sourceforge.net/exist/?rev=3070&view=rev}
695692
*
696693
* seconds-from-dateTime() returned wrong value when dateTime had
697694
* no millesecs available. Special value was returned.
@@ -751,7 +748,7 @@ public void namespaceURI() throws XMLDBException {
751748
}
752749

753750
@Test
754-
public void namespaceURI_contextItem() throws XPathException, XMLDBException {
751+
public void namespaceURI_contextItem() throws XMLDBException {
755752
final ResourceSet result = existEmbeddedServer.executeQuery(
756753
"let $a := <a><exist:b/></a>" +
757754
"return $a/exist:b/fn:namespace-uri()");
@@ -796,28 +793,28 @@ public void nodeName() throws XMLDBException {
796793
}
797794

798795
@Test
799-
public void noeName_empty() throws XPathException, XMLDBException {
796+
public void noeName_empty() throws XMLDBException {
800797
final ResourceSet result = existEmbeddedServer.executeQuery(
801798
"fn:node-name(())");
802799
assertEquals(0, result.getSize());
803800
}
804801

805802
@Test
806-
public void nodeName_emptyElement() throws XPathException, XMLDBException {
803+
public void nodeName_emptyElement() throws XMLDBException {
807804
final ResourceSet result = existEmbeddedServer.executeQuery(
808805
"<a>b</a>/fn:node-name(c)");
809806
assertEquals(0, result.getSize());
810807
}
811808

812809
@Test
813-
public void nodeName_emptyText() throws XPathException, XMLDBException {
810+
public void nodeName_emptyText() throws XMLDBException {
814811
final ResourceSet result = existEmbeddedServer.executeQuery(
815812
"<a>b</a>/fn:node-name(text())");
816813
assertEquals(0, result.getSize());
817814
}
818815

819816
@Test
820-
public void nodeName_contextItem() throws XPathException, XMLDBException {
817+
public void nodeName_contextItem() throws XMLDBException {
821818
final ResourceSet result = existEmbeddedServer.executeQuery(
822819
"let $a := <a><b/></a>" +
823820
"return $a/b/fn:node-name()");
@@ -826,7 +823,7 @@ public void nodeName_contextItem() throws XPathException, XMLDBException {
826823
}
827824

828825
@Test
829-
public void nodeName_contextItem_empty() throws XPathException, XMLDBException {
826+
public void nodeName_contextItem_empty() throws XMLDBException {
830827
final ResourceSet result = existEmbeddedServer.executeQuery(
831828
"let $a := <a><b/></a>" +
832829
"return $a/b/c/fn:node-name()");
@@ -978,11 +975,11 @@ private void runCollectionAvailableTest(String collectionPath, boolean expectedR
978975
String query = importXMLDB + collectionAvailable;
979976
ResourceSet result = existEmbeddedServer.executeQuery(query);
980977
assertNotNull(result);
981-
assertTrue(result.getSize() == 1);
978+
assertEquals(1, result.getSize());
982979
assertNotNull(result.getResource(0));
983980
String content = (String) result.getResource(0).getContent();
984981
assertNotNull(content);
985-
assertEquals(expectedResult, Boolean.valueOf(content).booleanValue());
982+
assertEquals(expectedResult, Boolean.valueOf(content));
986983
}
987984

988985
@Test

0 commit comments

Comments
 (0)