diff --git a/src/wrapper/java/org/kiwix/testing/catalog.xml b/src/wrapper/java/org/kiwix/testing/catalog.xml
new file mode 100644
index 000000000..3e2f6ac20
--- /dev/null
+++ b/src/wrapper/java/org/kiwix/testing/catalog.xml
@@ -0,0 +1,19 @@
+
+ 00000000-0000-0000-0000-000000000000
+
+ Test ZIM file
+ urn:uuid:86c91e51-55bf-8882-464e-072aca37a3e8
+ /meta?name=favicon&content=small
+ 2020-11-27:00::00:Z
+ en
+ This is a ZIM file used in libzim unit-tests
+ unit;test
+
+
+ Kiwix
+
+
+
+
+
+
diff --git a/src/wrapper/java/org/kiwix/testing/compile_test.sh b/src/wrapper/java/org/kiwix/testing/compile_test.sh
index a98569935..41899afaa 100755
--- a/src/wrapper/java/org/kiwix/testing/compile_test.sh
+++ b/src/wrapper/java/org/kiwix/testing/compile_test.sh
@@ -1,26 +1,37 @@
#!/usr/bin/bash
-# This script compile the unit test to test the java wrapper.
+# This script compiles and runs the unit test to test the java wrapper.
# This is not integrated in meson because ... this is not so easy.
+die()
+{
+ echo >&2 "!!! ERROR: $*"
+ exit 1
+}
+
KIWIX_LIB_JAR=$1
if [ -z $KIWIX_LIB_JAR ]
then
- echo "You must give the path to the kiwixlib.jar as first argument"
- exit 1
+ die "You must give the path to the kiwixlib.jar as first argument"
fi
KIWIX_LIB_DIR=$2
if [ -z $KIWIX_LIB_DIR ]
then
- echo "You must give the path to directory containing libkiwix.so as second argument"
- exit 1
+ die "You must give the path to directory containing libkiwix.so as second argument"
fi
-TEST_SOURCE_DIR=$(dirname $(readlink -f $0))
+KIWIX_LIB_JAR=$(readlink -f "$KIWIX_LIB_JAR")
+KIWIX_LIB_DIR=$(readlink -f "$KIWIX_LIB_DIR")
+TEST_SOURCE_DIR=$(dirname "$(readlink -f $0)")
-javac -g -d . -s . -cp $TEST_SOURCE_DIR/junit-4.13.jar:$KIWIX_LIB_JAR $TEST_SOURCE_DIR/test.java
+cd "$TEST_SOURCE_DIR"
-java -Djava.library.path=$KIWIX_LIB_DIR -cp $TEST_SOURCE_DIR/junit-4.13.jar:$TEST_SOURCE_DIR/hamcrest-core-1.3.jar:$KIWIX_LIB_JAR:. org.junit.runner.JUnitCore test
+javac -g -d . -s . -cp "junit-4.13.jar:$KIWIX_LIB_JAR" test.java \
+ || die "Compilation failed"
+java -Djava.library.path="$KIWIX_LIB_DIR" \
+ -cp "junit-4.13.jar:hamcrest-core-1.3.jar:$KIWIX_LIB_JAR:." \
+ org.junit.runner.JUnitCore test \
+ || die "Unit test failed"
diff --git a/src/wrapper/java/org/kiwix/testing/create_test_zimfiles b/src/wrapper/java/org/kiwix/testing/create_test_zimfiles
new file mode 100755
index 000000000..4610b7da2
--- /dev/null
+++ b/src/wrapper/java/org/kiwix/testing/create_test_zimfiles
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+die()
+{
+ echo >&2 "!!! ERROR: $*"
+ exit 1
+}
+
+cd "$(dirname "$0")"
+rm -f small.zim
+zimwriterfs --withoutFTIndex \
+ -w main.html \
+ -f favicon.png \
+ -l en \
+ -t "Test ZIM file" \
+ -d "N/A" \
+ -c "N/A" \
+ -p "N/A" \
+ small_zimfile_data \
+ small.zim \
+&& echo 'small.zim was successfully created' \
+|| die 'Failed to create small.zim'
+
+printf "BEGINZIM" > small.zim.embedded \
+&& cat small.zim >> small.zim.embedded \
+&& printf "ENDZIM" >> small.zim.embedded \
+&& echo 'small.zim.embedded was successfully created' \
+|| die 'Failed to create small.zim.embedded'
diff --git a/src/wrapper/java/org/kiwix/testing/small.zim b/src/wrapper/java/org/kiwix/testing/small.zim
new file mode 100644
index 000000000..bce4fc57a
Binary files /dev/null and b/src/wrapper/java/org/kiwix/testing/small.zim differ
diff --git a/src/wrapper/java/org/kiwix/testing/small.zim.embedded b/src/wrapper/java/org/kiwix/testing/small.zim.embedded
new file mode 100644
index 000000000..1bc1da2c2
Binary files /dev/null and b/src/wrapper/java/org/kiwix/testing/small.zim.embedded differ
diff --git a/src/wrapper/java/org/kiwix/testing/small_zimfile_data/favicon.png b/src/wrapper/java/org/kiwix/testing/small_zimfile_data/favicon.png
new file mode 100644
index 000000000..809454352
Binary files /dev/null and b/src/wrapper/java/org/kiwix/testing/small_zimfile_data/favicon.png differ
diff --git a/src/wrapper/java/org/kiwix/testing/small_zimfile_data/main.html b/src/wrapper/java/org/kiwix/testing/small_zimfile_data/main.html
new file mode 100644
index 000000000..c12e5739e
--- /dev/null
+++ b/src/wrapper/java/org/kiwix/testing/small_zimfile_data/main.html
@@ -0,0 +1,11 @@
+
+