Package org.dbunit.dataset
Class RequiredLibrary
java.lang.Object
org.dbunit.dataset.RequiredLibrary
A library that only some of dbUnit's features need, and so is an optional dependency, with the
means to say what to add when it is missing. Without this check the first use of the library
surfaces as a bare
NoClassDefFoundError from deep inside a producer, writer or
comparer, naming one of the library's classes and not what to do about it.
Whether the library is present is asked of the class loader of the class that needs it, since that is the loader that will resolve the library's classes.
- Since:
- 3.6.0
- Author:
- Jeff Jensen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RequiredLibraryJackson, needed to read and write JSON datasets and to compare JSON column values.static final RequiredLibrarySnakeYAML, needed to read and write YAML datasets. -
Method Summary
Modifier and TypeMethodDescriptionvoidFails with a message saying what to add when the library is not on the classpath of the class that needs it.voidrequireUnchecked(Class<?> requester) Likerequire(Class), for a constructor that declares no checked exception.
-
Field Details
-
JACKSON
Jackson, needed to read and write JSON datasets and to compare JSON column values. -
SNAKEYAML
SnakeYAML, needed to read and write YAML datasets.
-
-
Method Details
-
require
Fails with a message saying what to add when the library is not on the classpath of the class that needs it. A library that is present but cannot be used, such as a jar built for a newer Java, is not reported as missing: loading it fails with its own, more telling error.- Parameters:
requester- The class that needs the library; its class loader is the one asked.- Throws:
DataSetException- If the library is not present.
-
requireUnchecked
Likerequire(Class), for a constructor that declares no checked exception.- Parameters:
requester- The class that needs the library; its class loader is the one asked.- Throws:
DatabaseUnitRuntimeException- If the library is not present.
-