Skip to content

Commit 43abe23

Browse files
committed
[refactor] Improve test code..
1 parent 727e6b8 commit 43abe23

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

exist-core/src/main/java/org/exist/test/DiffMatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private DiffMatcher(final Source expectedSource, final boolean identical) {
6666

6767
/**
6868
* Compares that the XML sources are similar.
69-
*
69+
* <p>
7070
* In this context "similar" is defined by {@link DiffBuilder#checkForSimilar()}.
7171
*
7272
* @param expectedSource the expected XML
@@ -79,7 +79,7 @@ public static DiffMatcher hasSimilarXml(final Source expectedSource) {
7979

8080
/**
8181
* Compares that the XML sources are identical.
82-
*
82+
* <p>
8383
* In this context "similar" is defined by {@link DiffBuilder#checkForIdentical()} ()}.
8484
*
8585
* @param expectedSource the expected XML
@@ -101,7 +101,7 @@ public boolean matches(final Object item, final Description mismatch) {
101101
if (item instanceof NodeValue) {
102102
actualItem = (NodeValue) item;
103103

104-
} else if (item instanceof Sequence actual) {
104+
} else if (item instanceof final Sequence actual) {
105105

106106
if (actual.getItemCount() != 1) {
107107
mismatch.appendText("Sequence does not contain 1 item");

exist-core/src/main/java/org/exist/test/ExistEmbeddedServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void startDb() throws DatabaseConfigurationException, EXistException, IOE
142142
});
143143

144144
if (useTemporaryStorage) {
145-
if (!temporaryStorage.isPresent()) {
145+
if (temporaryStorage.isEmpty()) {
146146
this.temporaryStorage = Optional.of(Files.createTempDirectory("org.exist.test.ExistEmbeddedServer"));
147147
}
148148
config.setProperty(BrokerPool.PROPERTY_DATA_DIR, temporaryStorage.get());

exist-core/src/main/java/org/exist/test/ExistXmldbEmbeddedServer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import java.io.IOException;
4343
import java.nio.file.Path;
4444
import java.util.Map;
45-
import java.util.Properties;
4645

4746
import static org.junit.Assert.assertEquals;
4847
import static org.junit.Assert.fail;

exist-core/src/main/java/org/exist/test/TransactionTestDSL.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@
5858
/**
5959
* A DSL for describing a schedule of
6060
* transaction operations upon the database.
61-
*
61+
* <p>
6262
* A type-safe builder pattern is provided
6363
* for constructing the schedule. Once
6464
* the schedule is build a scheduler
6565
* can execute it upon the database
6666
* and return the results.
67-
*
67+
* <p>
6868
* The DSL uses recursive types
6969
* in a similar way to a typed heterogeneous
7070
* list (such as Shapeless's HList) to ensure
@@ -74,10 +74,10 @@
7474
* At the cost of complexity in implementing
7575
* the DSL, the recursive typing makes use of
7676
* the DSL by the user much simpler and safer.
77-
*
77+
* <p>
7878
* The recursive type implementation was
7979
* inspired by <a href="https://apocalisp.wordpress.com/2008/10/23/heterogeneous-lists-and-the-limits-of-the-java-type-system/">https://apocalisp.wordpress.com/2008/10/23/heterogeneous-lists-and-the-limits-of-the-java-type-system/</a>.
80-
*
80+
* <p>
8181
* Example usage for creating a schedule of
8282
* two transactions, where each will execute in
8383
* its own thread but operationally linear
@@ -116,7 +116,7 @@ public interface TransactionTestDSL {
116116

117117
/**
118118
* A Transaction Schedule builder.
119-
*
119+
* <p>
120120
* Enables us to build a schedule of operations to be executed
121121
* within one or more transactions.
122122
*
@@ -146,7 +146,7 @@ static BiTransactionScheduleBuilderFactory biSchedule() {
146146

147147
/**
148148
* A schedule builder factory for two transactions T1 and T2.
149-
*
149+
* <p>
150150
* Responsible for creating a Schedule Builder which is initialized
151151
* to the first transaction state.
152152
*/
@@ -462,7 +462,7 @@ U execute(final BrokerPool brokerPool, final ExecutionListener executionListener
462462

463463
/**
464464
* A schedule of two transactions T1 and T2.
465-
*
465+
* <p>
466466
* Which are executed concurrently, each in their
467467
* own thread, but linearly according to the schedule.
468468
*
@@ -551,7 +551,7 @@ public Tuple2<U1, U2> execute(final BrokerPool brokerPool, final ExecutionListen
551551

552552
/**
553553
* A function which describes an operation on the database with a Transaction.
554-
*
554+
* <p>
555555
* You can think of this as a function <pre>f(T) -&gt; U</pre>
556556
* where the database and transaction are available to the
557557
* function <pre>f</pre>.
@@ -691,7 +691,7 @@ static <T> TransactionOperation<T, T> abort() {
691691
* Executes this, and then the other Transaction Operation
692692
* on the input type {@code <T>} and returns
693693
* the results as a tuple.
694-
*
694+
* <p>
695695
* e.g. <pre>Tuple2(f(T) -&gt; U, other(T) -&gt; U2)</pre>
696696
*
697697
* @param <U2> thr result of the other operation.
@@ -707,7 +707,7 @@ default <U2> TransactionOperation<T, Tuple2<U, U2>> with(final TransactionOperat
707707
/**
708708
* Returns a composed function that first applies this function to
709709
* its input, and then applies the {@code after} function to the result.
710-
*
710+
* <p>
711711
* See {@link Function#andThen(Function)}
712712
*
713713
* @param <V> the result of the after operation.
@@ -723,7 +723,7 @@ default <V> TransactionOperation<T, V> andThen(final TransactionOperation<? supe
723723
/**
724724
* Returns a composed function that first applies the {@code before}
725725
* function to its input, and then applies this function to the result.
726-
*
726+
* <p>
727727
* See {@link Function#compose(Function)}
728728
*
729729
* @param <V> the input type of the before operation.
@@ -739,7 +739,7 @@ default <V> TransactionOperation<V, U> compose(final TransactionOperation<? supe
739739

740740
/**
741741
* Returns a function that always returns its input argument.
742-
*
742+
* <p>
743743
* See {@link Function#identity()}
744744
*
745745
* @param <T> the result of the identity operation.
@@ -754,7 +754,7 @@ static <T> TransactionOperation<T, T> identity() {
754754
/**
755755
* A simple extension of {@link CountDownLatch}
756756
* which also provides a name for the latch.
757-
*
757+
* <p>
758758
* Useful for debugging latching ordering in
759759
* transaction schedules.
760760
*/

exist-core/src/main/java/org/exist/test/runner/XSuite.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import java.util.ArrayList;
4242
import java.util.Collections;
4343
import java.util.List;
44-
import java.util.stream.Collectors;
4544
import java.util.stream.Stream;
4645

4746
/**

0 commit comments

Comments
 (0)