From ae733d4b207b6b7a9d23c7252c14e1653426c62f Mon Sep 17 00:00:00 2001 From: "Kevin S. Clarke" Date: Wed, 13 Sep 2023 00:37:49 -0400 Subject: [PATCH] V2 update deps (#188) * Update dependencies * Update jackson dependency * Reformat to newer parent project's formatting rules --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 8 +-- pom.xml | 9 +-- .../iiif/presentation/v2/Canvas.java | 6 +- .../iiif/presentation/v2/ImageContent.java | 40 +++---------- .../iiif/presentation/v2/Manifest.java | 7 ++- .../iiif/presentation/v2/Resource.java | 8 ++- .../iiif/presentation/v2/Sequence.java | 1 + .../iiif/presentation/v2/ServiceImage.java | 15 ++--- .../v2/properties/I18nProperty.java | 17 +++--- .../presentation/v2/properties/License.java | 10 ++-- .../presentation/v2/properties/Metadata.java | 42 +++++-------- .../presentation/v2/properties/NavDate.java | 5 ++ .../presentation/v2/properties/SeeAlso.java | 11 +++- .../v2/properties/ServiceProperty.java | 6 +- .../iiif/presentation/v2/properties/Type.java | 1 + .../v2/properties/ViewingHint.java | 9 ++- .../v2/services/APIComplianceLevel.java | 4 +- .../v2/services/GenericService.java | 11 +++- .../v2/services/GeoJSONService.java | 2 +- .../v2/utils/MetadataDeserializer.java | 2 +- src/main/tools/checkstyle/checkstyle.xml | 22 +++++-- .../iiif/presentation/v2/AbstractTest.java | 4 ++ .../presentation/v2/AnnotationListTest.java | 1 + .../iiif/presentation/v2/AnnotationTest.java | 1 + .../iiif/presentation/v2/CanvasTest.java | 2 + .../iiif/presentation/v2/CollectionTest.java | 16 +++-- .../iiif/presentation/v2/FixturesTest.java | 59 +++++++++++++++++++ .../presentation/v2/ImageContentTest.java | 2 + .../presentation/v2/ImageResourceTest.java | 6 +- .../iiif/presentation/v2/LayerTest.java | 2 + .../iiif/presentation/v2/ManifestTest.java | 23 +++++++- .../iiif/presentation/v2/ManifestorTest.java | 7 ++- .../presentation/v2/OtherContentTest.java | 3 + .../iiif/presentation/v2/RangeTest.java | 2 + .../iiif/presentation/v2/ResourceTest.java | 7 +++ .../iiif/presentation/v2/SequenceTest.java | 2 + .../v2/properties/AttributionTest.java | 3 +- .../v2/properties/DescriptionTest.java | 3 +- .../v2/properties/I18nPropertyTest.java | 17 ++++-- .../presentation/v2/properties/LabelTest.java | 7 ++- .../v2/properties/LicenseTest.java | 3 +- .../presentation/v2/properties/LogoTest.java | 15 ++++- .../v2/properties/MetadataTest.java | 11 +++- .../v2/properties/SeeAlsoTest.java | 5 +- .../v2/properties/ThumbnailTest.java | 11 +++- .../presentation/v2/properties/TypeTest.java | 4 +- .../presentation/v2/properties/ValueTest.java | 5 +- .../v2/properties/ViewingDirectionTest.java | 1 + .../v2/properties/ViewingHintTest.java | 23 +++++--- .../v2/services/APIComplianceLevelTest.java | 5 +- .../v2/services/GeoJSONServiceTest.java | 3 +- .../v2/services/ImageInfoServiceTest.java | 4 +- .../v2/services/PhysicalDimsServiceTest.java | 5 +- .../presentation/v2/utils/GenericTest.java | 4 +- .../v2/utils/MetadataDeserializerTest.java | 10 +++- .../iiif/presentation/v2/utils/TestUtils.java | 4 ++ 57 files changed, 365 insertions(+), 153 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7778bf78..31b6ebbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: MAVEN_CACHE_KEY: ${{ secrets.MAVEN_CACHE_KEY }} strategy: matrix: - java: [ 11, 17 ] + java: [ 17 ] steps: - name: Check out code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4105fea..9c295fee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,13 @@ name: Maven Release -# Performs a Maven release using JDK 11 when a new GitHub release has been published +# Performs a Maven release using JDK 17 when a new GitHub release has been published on: release: types: [ published ] jobs: publish: - name: Maven Artifact Publisher (JDK 11) + name: Maven Artifact Publisher (JDK 17) runs-on: ubuntu-latest env: AUTORELEASE_ARTIFACT: ${{ secrets.AUTORELEASE_ARTIFACT }} @@ -15,10 +15,10 @@ jobs: steps: - name: Check out source code uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2 - - name: Install JDK 11 and Maven + - name: Install JDK 17 and Maven uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v1 with: - java-version: 11 + java-version: 17 # If running locally in act, install Maven - name: Set up Maven if needed if: ${{ env.ACT }} diff --git a/pom.xml b/pom.xml index 653013d2..09952e4f 100644 --- a/pom.xml +++ b/pom.xml @@ -38,16 +38,17 @@ America/New_York + 0.0.0-SNAPSHOT - 2.13.4 - 2.13.4.2 + 2.15.2 + 2.15.2 32.0.0-jre - 3.2.4 + 4.0.2 4.4.5 @@ -216,7 +217,7 @@ freelib-parent info.freelibrary - 7.4.2 + 8.0.3 diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/Canvas.java b/src/main/java/info/freelibrary/iiif/presentation/v2/Canvas.java index 66b08577..cc8673ed 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/Canvas.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/Canvas.java @@ -13,6 +13,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonSetter; +import info.freelibrary.util.IllegalArgumentI18nException; + import info.freelibrary.iiif.presentation.v2.properties.Attribution; import info.freelibrary.iiif.presentation.v2.properties.Description; import info.freelibrary.iiif.presentation.v2.properties.Label; @@ -27,7 +29,6 @@ import info.freelibrary.iiif.presentation.v2.services.Service; import info.freelibrary.iiif.presentation.v2.utils.Constants; import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; -import info.freelibrary.util.IllegalArgumentI18nException; /** * A virtual container that represents a page or view and has content resources associated with it or with parts of it. @@ -238,6 +239,7 @@ public Canvas setOtherContent(final OtherContent... aOtherContentArray) { * * @param aImageContent Image content to be added to the canvas * @return The canvas + * @throws UnsupportedOperationException If a supplied {@link ImageContent} could not be added */ public Canvas addImageContent(final ImageContent... aImageContent) { if (!Collections.addAll(getImageContent(), aImageContent)) { @@ -252,6 +254,7 @@ public Canvas addImageContent(final ImageContent... aImageContent) { * * @param aOtherContent Other content to be added to the canvas * @return The canvas + * @throws UnsupportedOperationException If a supplied {@link OtherContent} could not be added */ public Canvas addOtherContent(final OtherContent... aOtherContent) { if (Collections.addAll(getOtherContent(), aOtherContent)) { @@ -419,6 +422,7 @@ public Canvas setSeeAlso(final String aSeeAlso) { * * @param aWidth A canvas width * @param aHeight A canvas height + * @throws IllegalArgumentI18nException If the height or width is less than zero */ @JsonIgnore private void setWidthHeight(final int aWidth, final int aHeight) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/ImageContent.java b/src/main/java/info/freelibrary/iiif/presentation/v2/ImageContent.java index 0d33843b..a54ef024 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/ImageContent.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/ImageContent.java @@ -15,7 +15,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonSetter; -import info.freelibrary.util.I18nRuntimeException; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; import info.freelibrary.util.StringUtils; @@ -112,10 +111,16 @@ public String getMotivation() { return MOTIVATION; } + /** + * Sets the image content's motivation. + * + * @param aMotivation A motivation value + * @throws IllegalArgumentException If the wrong motivation is supplied + */ @JsonSetter(Constants.MOTIVATION) private void setMotivation(final String aMotivation) { if (!MOTIVATION.equals(aMotivation)) { - throw new I18nRuntimeException(); + throw new IllegalArgumentException(); } } @@ -416,44 +421,13 @@ private ImageResource buildImageResource(final Object aImageResourceMap) { return null; } - /** - * A image resource map. - */ final Map map = (Map) aImageResourceMap; - - /** - * A new image resource. - */ final ImageResource resource = new ImageResource(URI.create((String) map.get(Constants.ID))); - - /** - * The image resource label. - */ final String label = (String) map.get(Constants.LABEL); - - /** - * The image resource service map. - */ final Map service = (Map) map.get(Constants.SERVICE); - - /** - * The image resource map's width object. - */ final Object widthObj = map.get(Constants.WIDTH); - - /** - * The image resource map's height object. - */ final Object heightObj = map.get(Constants.HEIGHT); - - /** - * The image resource's width. - */ final int width; - - /** - * The image resource's height. - */ final int height; if (widthObj == null) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/Manifest.java b/src/main/java/info/freelibrary/iiif/presentation/v2/Manifest.java index 6fc49dd1..2c1e024a 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/Manifest.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/Manifest.java @@ -70,7 +70,7 @@ public class Manifest extends Resource { private static final String TYPE = "sc:Manifest"; /** - * The manifest's context + * The manifest's context. */ private static final URI CONTEXT = URI.create("http://iiif.io/api/presentation/2/context.json"); @@ -181,7 +181,7 @@ public URI getContext() { } /** - * Adds a new context URI to the manifest + * Adds a new context URI to the manifest. * * @param aContext Manifest context URIs(s) * @return The manifest @@ -192,7 +192,7 @@ public Manifest addContext(final URI... aContext) { } /** - * Adds a new context URI to the manifest + * Adds a new context URI to the manifest. * * @param aContext Manifest context URI(s) * @return The manifest @@ -268,6 +268,7 @@ public ViewingDirection getViewingDirection() { * * @param aSequence Sequence(s) to add to the manifest * @return The manifest + * @throws UnsupportedOperationException If a supplied sequence couldn't be added to the manifest */ public Manifest addSequence(final Sequence... aSequence) { Objects.requireNonNull(aSequence, LOGGER.getMessage(MessageCodes.JPA_008)); diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/Resource.java b/src/main/java/info/freelibrary/iiif/presentation/v2/Resource.java index 8ac1c75e..c62350d6 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/Resource.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/Resource.java @@ -13,6 +13,9 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonUnwrapped; +import info.freelibrary.util.Logger; +import info.freelibrary.util.LoggerFactory; + import info.freelibrary.iiif.presentation.v2.properties.Attribution; import info.freelibrary.iiif.presentation.v2.properties.Description; import info.freelibrary.iiif.presentation.v2.properties.Label; @@ -27,8 +30,6 @@ import info.freelibrary.iiif.presentation.v2.services.Service; import info.freelibrary.iiif.presentation.v2.utils.Constants; import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; -import info.freelibrary.util.Logger; -import info.freelibrary.util.LoggerFactory; /** * A resource that can be used as a base for more specific IIIF presentation resources. @@ -709,11 +710,14 @@ protected Resource setSeeAlso(final String aSeeAlso) { * @param aArgs An array of arguments passed to the constructor * @param aNames An array of names corresponding to the arguments passed to the constructor * @param aNumber The number of required arguments + * @throws IndexOutOfBoundsException If the supplied number is out of bounds + * @throws IllegalArgumentException If the supplied object and string arrays aren't the same length */ private void checkArgs(final Object[] aArgs, final String[] aNames, final int aNumber) { if (aArgs.length < aNumber) { throw new IndexOutOfBoundsException(String.valueOf(aNumber)); } + if (aArgs.length != aNames.length) { throw new IllegalArgumentException("Number of arguments is not equal to the number of names"); } diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/Sequence.java b/src/main/java/info/freelibrary/iiif/presentation/v2/Sequence.java index 3cb55dd4..99e7a41f 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/Sequence.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/Sequence.java @@ -172,6 +172,7 @@ public Sequence setCanvases(final Canvas... aCanvas) { * * @param aCanvas A canvas to add to this sequence * @return The sequence + * @throws UnsupportedOperationException If a supplied canvas could not be added */ public Sequence addCanvas(final Canvas... aCanvas) { if (!Collections.addAll(myCanvases, aCanvas)) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/ServiceImage.java b/src/main/java/info/freelibrary/iiif/presentation/v2/ServiceImage.java index e3c04ddd..5c17fdb6 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/ServiceImage.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/ServiceImage.java @@ -13,15 +13,16 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.google.common.net.MediaType; +import info.freelibrary.util.FileUtils; +import info.freelibrary.util.Logger; +import info.freelibrary.util.LoggerFactory; + import info.freelibrary.iiif.presentation.v2.properties.Logo; import info.freelibrary.iiif.presentation.v2.properties.Thumbnail; import info.freelibrary.iiif.presentation.v2.services.ImageInfoService; import info.freelibrary.iiif.presentation.v2.services.Service; import info.freelibrary.iiif.presentation.v2.utils.Constants; import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; -import info.freelibrary.util.FileUtils; -import info.freelibrary.util.Logger; -import info.freelibrary.util.LoggerFactory; /** * An image resource from a {@link Service} that is used as an {@link ImageResource}, and in {@link Logo}s and @@ -68,7 +69,7 @@ public class ServiceImage { private Optional myService; /** - * Creates an image + * Creates an image. * * @param aURI An image ID */ @@ -82,7 +83,7 @@ public ServiceImage(final String aURI) { } /** - * Creates an image + * Creates an image. * * @param aID An image ID */ @@ -260,7 +261,7 @@ public int getHeight() { } /** - * Gets the image ID + * Gets the image ID. * * @return The image ID */ @@ -306,7 +307,7 @@ public Optional getService() { } /** - * Sets the image's service + * Sets the image's service. * * @param aService The image's service * @return The image diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/I18nProperty.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/I18nProperty.java index c96c1682..5dff30e9 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/I18nProperty.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/I18nProperty.java @@ -3,17 +3,17 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.List; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; -import info.freelibrary.iiif.presentation.v2.utils.Constants; -import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; +import info.freelibrary.iiif.presentation.v2.utils.Constants; +import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; + /** * A property value that can be used in the label, description, attribution and the label and value fields. */ @@ -92,6 +92,7 @@ public String getString() { * * @param aValue A String property value * @return A String value to the property + * @throws UnsupportedOperationException If a supplied value could not be added */ protected I18nProperty addValue(final String... aValue) { Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001)); @@ -112,6 +113,7 @@ protected I18nProperty addValue(final String... aValue) { * * @param aValue A I18N property value * @return A String value to the property + * @throws UnsupportedOperationException If a supplied value could not be added */ protected I18nProperty addValue(final Value... aValue) { Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001)); @@ -158,21 +160,20 @@ public int hashCode() { */ @JsonValue protected Object getJsonValue() { + final List list = new ArrayList<>(); + if (!hasValues()) { return null; } + if (myValues.size() == Constants.SINGLE_INSTANCE) { if (myValues.get(0).getLang().isPresent()) { return myValues.get(0); } return myValues.get(0).getValue(); } - final List list = new ArrayList<>(); - final Iterator iterator = myValues.iterator(); - - while (iterator.hasNext()) { - final Value entry = iterator.next(); + for (final Value entry : myValues) { if (entry.getLang().isPresent()) { list.add(entry); } else { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/License.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/License.java index 9acbb51b..238b8eea 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/License.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/License.java @@ -20,14 +20,10 @@ */ public class License { - /** - * The list padding for license. - */ + /** The list padding for license. */ private static final int LIST_PADDING = 2; - /** - * The URLs associated with the license. - */ + /** The URLs associated with the license. */ private final List myURLs; /** @@ -58,6 +54,7 @@ public License(final URL... aURL) { * Creates a new license property. * * @param aURL A license's URL + * @throws MalformedURLException If the supplied value isn't a valid URL */ @SuppressWarnings("unused") private License(final String aURL) throws MalformedURLException { @@ -106,6 +103,7 @@ public License setValue(final String... aValue) throws MalformedURLException { * * @param aURL Additional license URL(s) * @return True if the supplied URL(s) were added + * @throws UnsupportedOperationException If a supplied license URL could not be added */ @JsonIgnore public License addValue(final URL... aURL) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Metadata.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Metadata.java index 0d80a725..64b85e07 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Metadata.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Metadata.java @@ -2,7 +2,6 @@ package info.freelibrary.iiif.presentation.v2.properties; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -13,11 +12,12 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import info.freelibrary.util.Logger; +import info.freelibrary.util.LoggerFactory; + import info.freelibrary.iiif.presentation.v2.utils.Constants; import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.iiif.presentation.v2.utils.MetadataDeserializer; -import info.freelibrary.util.Logger; -import info.freelibrary.util.LoggerFactory; /** * A list of short descriptive entries, given as pairs of human readable label and value to be displayed to the user. @@ -105,6 +105,7 @@ public Metadata(final String aLabel, final Value... aValue) { * * @param aMetadataEntry A metadata entry * @return The metadata + * @throws UnsupportedOperationException If the supplied metadata entry couldn't be added */ public Metadata add(final Metadata.Entry aMetadataEntry) { if (!getEntries().add(aMetadataEntry)) { @@ -120,6 +121,7 @@ public Metadata add(final Metadata.Entry aMetadataEntry) { * @param aLabel A metadata label * @param aValue A metadata values list * @return The metadata + * @throws UnsupportedOperationException If a supplied label and value couldn't be added */ public Metadata add(final String aLabel, final String... aValue) { if (!getEntries().add(new Metadata.Entry(aLabel, aValue))) { @@ -135,6 +137,7 @@ public Metadata add(final String aLabel, final String... aValue) { * @param aLabel A metadata label * @param aValue A metadata values list * @return The metadata + * @throws UnsupportedOperationException If a supplied label and value couldn't be added */ public Metadata add(final String aLabel, final Value... aValue) { if (!getEntries().add(new Metadata.Entry(aLabel, aValue))) { @@ -152,11 +155,7 @@ public Metadata add(final String aLabel, final Value... aValue) { */ @JsonIgnore public Optional getValue(final String aLabel) { - final Iterator iterator = myEntries.iterator(); - - while (iterator.hasNext()) { - final Metadata.Entry entry = iterator.next(); - + for (final Entry entry : myEntries) { if (entry.getLabel().equals(aLabel)) { return Optional.of(entry.getString()); } @@ -174,16 +173,9 @@ public Optional getValue(final String aLabel) { */ @JsonIgnore public Optional getValue(final String aLabel, final String aLangCode) { - final Iterator entryIterator = myEntries.iterator(); - - while (entryIterator.hasNext()) { - final Metadata.Entry entry = entryIterator.next(); - + for (final Entry entry : myEntries) { if (entry.getLabel().equals(aLabel)) { - final Iterator valuesIterator = entry.myValues.iterator(); - - while (valuesIterator.hasNext()) { - final Value value = valuesIterator.next(); + for (final Value value : entry.myValues) { final Optional lang = value.getLang(); if (lang.isPresent() && lang.get().equals(aLangCode)) { @@ -204,11 +196,7 @@ public Optional getValue(final String aLabel, final String aLangCode) { */ @JsonIgnore public List getValues(final String aLabel) { - final Iterator iterator = myEntries.iterator(); - - while (iterator.hasNext()) { - final Metadata.Entry entry = iterator.next(); - + for (final Entry entry : myEntries) { if (entry.getLabel().equals(aLabel)) { return entry.getValues(); } @@ -274,7 +262,7 @@ public Entry(final String aLabel, final Value... aValue) { } /** - * Returns true if the metadata entry has values; else, false + * Returns true if the metadata entry has values; else, false. * * @return True if the metadata entry has values; else, false */ @@ -346,6 +334,7 @@ public Entry setValues(final Value... aValue) { * * @param aValue A list of values * @return The metadata entry + * @throws UnsupportedOperationException If a supplied value couldn't be added */ public final Entry addValues(final String... aValue) { Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001)); @@ -366,6 +355,7 @@ public final Entry addValues(final String... aValue) { * * @param aValue A list of values * @return The metadata entry + * @throws UnsupportedOperationException If a supplied value could not be added */ public final Entry addValues(final Value... aValue) { Objects.requireNonNull(aValue, LOGGER.getMessage(MessageCodes.JPA_001)); @@ -398,11 +388,7 @@ private Object getJsonValue() { } final List list = new ArrayList<>(); - final Iterator iterator = myValues.iterator(); - - while (iterator.hasNext()) { - final Value entry = iterator.next(); - + for (final Value entry : myValues) { if (entry.getLang().isPresent()) { list.add(entry); } else { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/NavDate.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/NavDate.java index c70a4494..17c20084 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/NavDate.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/NavDate.java @@ -35,6 +35,11 @@ public NavDate(final ZonedDateTime aZonedDateTime) { myZonedDateTime = zdt.format(DateTimeFormatter.ISO_INSTANT); } + /** + * Creates a new {@link NavDate}. + * + * @param aZonedDateTime A zoned date time + */ private NavDate(final String aZonedDateTime) { myZonedDateTime = aZonedDateTime; } diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlso.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlso.java index 93c40bed..ae842729 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlso.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlso.java @@ -13,11 +13,12 @@ import com.google.common.collect.ImmutableMap; import com.google.common.net.MediaType; -import info.freelibrary.iiif.presentation.v2.utils.Constants; -import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; +import info.freelibrary.iiif.presentation.v2.utils.Constants; +import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; + /** * A link to a machine readable document that semantically describes the resource with the seeAlso property, such as an * XML or RDF description. This document could be used for search and discovery or inferencing purposes, or just to @@ -40,6 +41,7 @@ public class SeeAlso { * Creates a new see also. * * @param aID The see also's ID(s) + * @throws UnsupportedOperationException If a supplied seeAlso ID couldn't be added */ public SeeAlso(final String... aID) { myValues = new ArrayList<>(); @@ -57,6 +59,7 @@ public SeeAlso(final String... aID) { * Creates a new see also. * * @param aID The see also's ID(s) + * @throws UnsupportedOperationException If a supplied ID could not be added */ public SeeAlso(final URI... aID) { myValues = new ArrayList<>(); @@ -86,6 +89,7 @@ public SeeAlso(final String aID, final MediaType aMediaType) { * * @param aID The see also's ID * @param aMediaType A media type + * @throws UnsupportedOperationException If the supplied ID and media type couldn't be set */ public SeeAlso(final URI aID, final MediaType aMediaType) { myValues = new ArrayList<>(); @@ -126,6 +130,7 @@ public SeeAlso(final String aID, final MediaType aMediaType, final String aProfi * @param aID The see also's ID * @param aMediaType A media type * @param aProfile A profile + * @throws UnsupportedOperationException If the supplied values couldn't be added as a seeAlso value */ public SeeAlso(final URI aID, final MediaType aMediaType, final URI aProfile) { myValues = new ArrayList<>(); @@ -195,6 +200,7 @@ public Optional getFormatMediaType() { * * @param aID A see also value * @return The see also + * @throws UnsupportedOperationException If the supplied ID couldn't be added to the seeAlso */ public SeeAlso addValue(final String... aID) { for (final String id : aID) { @@ -213,6 +219,7 @@ public SeeAlso addValue(final String... aID) { * * @param aID A see also value * @return The see also + * @throws UnsupportedOperationException If a supplied ID couldn't be added to the seeAlso */ public SeeAlso addValue(final URI... aID) { for (final URI id : aID) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ServiceProperty.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ServiceProperty.java index ab4be8ab..ff3ab912 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ServiceProperty.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ServiceProperty.java @@ -129,6 +129,7 @@ protected ServiceProperty addImage(final URI... aID) { * * @param aID The URI ID for the image * @return The property + * @throws UnsupportedOperationException If a URI couldn't be added */ private ServiceProperty addImagePrivately(final URI... aID) { for (final URI id : aID) { @@ -171,6 +172,7 @@ protected ServiceProperty addImage(final URI aURI, final int aWidth, final in * @param aWidth A image width * @param aHeight A image height * @return The property + * @throws UnsupportedOperationException If the supplied values cannot be added as a new {@link ServiceImage} */ private ServiceProperty addImagePrivately(final URI aURI, final int aWidth, final int aHeight) { if (!getImagesPrivately().add(new ServiceImage(aURI, aWidth, aHeight))) { @@ -208,6 +210,7 @@ protected ServiceProperty addImage(final URI aID, final ImageInfoService aSer * @param aID The ID for the image * @param aService A service for the image * @return The property + * @throws UnsupportedOperationException If a supplied ID and service couldn't be added */ private ServiceProperty addImagePrivately(final URI aID, final ImageInfoService aService) { if (!getImagesPrivately().add(new ServiceImage(aID, aService))) { @@ -249,7 +252,7 @@ public int count() { } /** - * Gets the first image ID + * Gets the first image ID. * * @return The first image ID */ @@ -317,6 +320,7 @@ protected ServiceProperty addImage(final ServiceImage... aImage) { * * @param aImage A list of images * @return The property + * @throws UnsupportedOperationException If a supplied {@link ServiceImage} couldn't be added */ private ServiceProperty addImagePrivately(final ServiceImage... aImage) { if (!Collections.addAll(getImagesPrivately(), aImage)) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Type.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Type.java index 8b99747f..cff69f29 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Type.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/Type.java @@ -77,6 +77,7 @@ public Type setValue(final String... aType) { * * @param aType A type value * @return The type property + * @throws UnsupportedOperationException If a supplied type couldn't be added */ public Type addValue(final String aType) { if (!myTypes.add(aType)) { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHint.java b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHint.java index 67a41a38..55af9e29 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHint.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHint.java @@ -11,11 +11,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonValue; -import info.freelibrary.iiif.presentation.v2.utils.Constants; -import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; +import info.freelibrary.iiif.presentation.v2.utils.Constants; +import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; + /** * A hint to the client as to the most appropriate method of displaying the resource. This specification defines the * values specified in the table below. Other values may be given, and if they are, they must be URIs. @@ -239,6 +240,7 @@ public ViewingHint setValue(final String... aValue) { * * @param aValue New values to add to the viewing hint * @return The viewing hint + * @throws UnsupportedOperationException If a supplied value couldn't be added */ public ViewingHint addValue(final String... aValue) { final ViewingHint.Value[] array = new ViewingHint.Value[aValue.length]; @@ -258,7 +260,7 @@ public ViewingHint addValue(final String... aValue) { } /** - * Gets the raw value of the viewing hint + * Gets the raw value of the viewing hint. *

* For a viewing hint with a single value this will be a String and for a viewing hint with multiple * values this will be a List<ViewingHint.Value>. @@ -307,6 +309,7 @@ public Value(final Option aOption) { * Create a new viewing hint from the supplied string. * * @param aValue A string representation of the viewing hint value + * @throws IllegalArgumentException If the supplied value isn't a URI */ public Value(final String aValue) { final String value = aValue.toUpperCase(Locale.US).replaceAll("\\-", ""); diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevel.java b/src/main/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevel.java index 81b86b51..d10a5d6a 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevel.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevel.java @@ -5,11 +5,12 @@ import java.net.URI; import java.net.URL; -import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.util.I18nRuntimeException; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; +import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; + /** * The profile levels supported by a IIIF Image API service. */ @@ -71,6 +72,7 @@ public URI uri() { * Returns a URL representation of the profile level. * * @return A URL representation of the profile level + * @throws I18nRuntimeException If the internal URL isn't a valid URL */ public URL url() { try { diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/services/GenericService.java b/src/main/java/info/freelibrary/iiif/presentation/v2/services/GenericService.java index 1c4aec22..4fee2c81 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/services/GenericService.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/services/GenericService.java @@ -14,12 +14,13 @@ import com.google.common.collect.ImmutableMap; import com.google.common.net.MediaType; -import info.freelibrary.iiif.presentation.v2.utils.Constants; -import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; import info.freelibrary.util.FileUtils; import info.freelibrary.util.Logger; import info.freelibrary.util.LoggerFactory; +import info.freelibrary.iiif.presentation.v2.utils.Constants; +import info.freelibrary.iiif.presentation.v2.utils.MessageCodes; + /** * A generic service class for other service implementations. */ @@ -203,6 +204,11 @@ public Optional getFormatMediaType() { return myFormat; } + /** + * Sets the media type from the supplied URI's extension. + * + * @param aURI A URI that contains a media type extension + */ @JsonIgnore private void setMediaTypeFromExt(final String aURI) { final String mimeType = FileUtils.getMimeType(aURI); @@ -222,6 +228,7 @@ private void setMediaTypeFromExt(final String aURI) { * Returns the service as a JSON value. * * @return The service as a JSON value + * @throws IllegalArgumentException If the service's ID isn't set */ @JsonValue @SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.UnusedPrivateMethod" }) diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONService.java b/src/main/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONService.java index 71c543cc..6574d1ae 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONService.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONService.java @@ -41,7 +41,7 @@ public URI getContext() { } /** - * Gets the ID + * Gets the ID. * * @return The ID */ diff --git a/src/main/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializer.java b/src/main/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializer.java index b6003e49..4a846d50 100644 --- a/src/main/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializer.java +++ b/src/main/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializer.java @@ -44,7 +44,7 @@ public MetadataDeserializer(final Class aClass) { } /** - * + * Deserializes the supplied metadata from its JSON source. */ @Override @SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.CognitiveComplexity" }) diff --git a/src/main/tools/checkstyle/checkstyle.xml b/src/main/tools/checkstyle/checkstyle.xml index 6d99c588..b3ad8427 100644 --- a/src/main/tools/checkstyle/checkstyle.xml +++ b/src/main/tools/checkstyle/checkstyle.xml @@ -44,14 +44,28 @@ - + + + + + + + - - + + + - + + + + + + + diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/AbstractTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/AbstractTest.java index fa25cfe4..6dbc96b5 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/AbstractTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/AbstractTest.java @@ -10,7 +10,11 @@ */ public class AbstractTest { + /** + * Creates a new abstract test. + */ protected AbstractTest() { + // This is intentionally empty } /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationListTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationListTest.java index ae34a94c..2ae16677 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationListTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationListTest.java @@ -16,6 +16,7 @@ */ public class AnnotationListTest { + /** A test value. */ private static final URI ID = URI.create("http://example.org/id"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationTest.java index 4aace108..78c5641f 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/AnnotationTest.java @@ -16,6 +16,7 @@ */ public class AnnotationTest { + /** A test value. */ private static final URI ID = URI.create("http://example.org/id"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/CanvasTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/CanvasTest.java index bc0600d6..9a58321d 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/CanvasTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/CanvasTest.java @@ -17,8 +17,10 @@ */ public class CanvasTest { + /** A test URI. */ private static final String TEST_URI = "http://example.org/iiif/book1/canvas/p1"; + /** A test label. */ private static final String TEST_LABEL = "My Test Canvas"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/CollectionTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/CollectionTest.java index d768c34b..1c168d84 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/CollectionTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/CollectionTest.java @@ -17,10 +17,12 @@ import org.junit.Before; import org.junit.Test; +import info.freelibrary.util.StringUtils; + import info.freelibrary.iiif.presentation.v2.properties.Label; import info.freelibrary.iiif.presentation.v2.properties.NavDate; import info.freelibrary.iiif.presentation.v2.properties.ViewingHint; -import info.freelibrary.util.StringUtils; + import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; @@ -29,12 +31,16 @@ */ public class CollectionTest { + /** A test file. */ private static final File TEST_FILE1 = new File("src/test/resources/json/collection1.json"); + /** A test ID. */ private String myID; + /** A test label. */ private String myLabel; + /** A Vert.x instance. */ private Vertx myVertx; /** @@ -53,7 +59,7 @@ public void setUp() { @Test public void testCollectionManifestManifestConstructor() { final Collection.Manifest manifest = - new Collection.Manifest(new info.freelibrary.iiif.presentation.v2.Collection.Manifest(myID, myLabel)); + new Collection.Manifest(new info.freelibrary.iiif.presentation.v2.Collection.Manifest(myID, myLabel)); assertEquals(URI.create(myID), manifest.getID()); assertEquals(new Label(myLabel), manifest.getLabel()); @@ -81,7 +87,7 @@ public void testNavDate1() { } /** - * Tests writing a simple collection manifest + * Tests writing a simple collection manifest. * * @throws IOException If there is trouble reading the test JSON file */ @@ -109,7 +115,7 @@ public void testWritingCollection() throws IOException { } /** - * Tests reading a collection + * Tests reading a collection. * * @throws IOException If there is trouble reading the test JSON file. */ @@ -151,7 +157,7 @@ public void testFromJSON() { @Test public void testFromString() { final String json = - myVertx.fileSystem().readFileBlocking(TEST_FILE1.getAbsolutePath()).toString(StandardCharsets.UTF_8); + myVertx.fileSystem().readFileBlocking(TEST_FILE1.getAbsolutePath()).toString(StandardCharsets.UTF_8); final Collection collection = Collection.fromString(json); assertEquals(new JsonObject(json), collection.toJSON()); diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/FixturesTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/FixturesTest.java index 6beb5faa..d35cbab5 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/FixturesTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/FixturesTest.java @@ -28,14 +28,19 @@ */ public class FixturesTest { + /** A test logger. */ private static final Logger LOGGER = LoggerFactory.getLogger(FixturesTest.class, MessageCodes.BUNDLE); + /** A test value. */ private static final String FIXTURE_PATH = "src/test/resources/fixtures/2.1/{}/manifest.json"; + /** A test value. */ private static final String COLLECTION_TEST_FILE = "src/test/resources/fixtures/2.1/collection.json"; + /** A test value. */ private static final String JSON_EXT = ".json"; + /** A test value. */ private String myTestID; /** @@ -627,10 +632,23 @@ public final void testCollectionFixture() throws IOException { assertEquals(expected, found); } + /** + * Creates a new test. + * + * @param aFixtureFilePath A fixture file path + * @throws IOException If there is trouble reading the fixture file + */ private void test(final String aFixtureFilePath) throws IOException { test(aFixtureFilePath, false); } + /** + * Creates a new test. + * + * @param aFixtureFilePath A fixture file path + * @param aFormatCheck A flag indicating whether to check format or not + * @throws IOException If there is trouble reading the fixture file + */ private void test(final String aFixtureFilePath, final boolean aFormatCheck) throws IOException { final TestData data = prepareTest(new File(aFixtureFilePath), aFormatCheck); @@ -644,6 +662,14 @@ private void test(final String aFixtureFilePath, final boolean aFormatCheck) thr } } + /** + * Sets up a test. + * + * @param aFixtureFile A test fixture file + * @param aFormatCheck A flag indicating whether format should be checked or not + * @return A new test data object + * @throws IOException If there is trouble reading from a test fixture + */ private TestData prepareTest(final File aFixtureFile, final boolean aFormatCheck) throws IOException { final File outputFile = File.createTempFile(myTestID, JSON_EXT); final Manifestor manifestor = new Manifestor(); @@ -663,6 +689,11 @@ private TestData prepareTest(final File aFixtureFile, final boolean aFormatCheck return new TestData(expected, found, outputFile); } + /** + * Cleans a supplied JSON object for comparison during testing. + * + * @param aJsonObject A JSON object + */ private void removeImageResourceFormat(final JsonObject aJsonObject) { final JsonArray sequences = aJsonObject.getJsonArray(Constants.SEQUENCES); @@ -706,28 +737,56 @@ private void removeImageResourceFormat(final JsonObject aJsonObject) { } } + /** + * Creates a new test data object. + */ private final class TestData { + /** An expected JSON object. */ private final JsonObject myExpected; + /** The found JSON object. */ private final JsonObject myFound; + /** A test file. */ private final File myTestFile; + /** + * Creates a new test data object. + * + * @param aExpected The expected JSON object + * @param aFound The found JSON object + * @param aTestFile A test file + */ private TestData(final JsonObject aExpected, final JsonObject aFound, final File aTestFile) { myExpected = aExpected; myFound = aFound; myTestFile = aTestFile; } + /** + * Gets the expected test result. + * + * @return A JSON object + */ private JsonObject getExpected() { return myExpected; } + /** + * Gets the actual test result. + * + * @return A JSON object + */ private JsonObject getFound() { return myFound; } + /** + * Gets the test file. + * + * @return A file + */ private File getTestFile() { return myTestFile; } diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/ImageContentTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/ImageContentTest.java index 77ff8c1b..8f20a1c8 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/ImageContentTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/ImageContentTest.java @@ -15,8 +15,10 @@ */ public class ImageContentTest { + /** A test value. */ private String myID; + /** A test value. */ private String myLabel; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/ImageResourceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/ImageResourceTest.java index e4d9a09d..e3ad8c9e 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/ImageResourceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/ImageResourceTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.URI; @@ -16,12 +16,16 @@ */ public class ImageResourceTest { + /** A test URI. */ private static final URI IMAGE_URI = URI.create("http://example.org/image/001.jpg"); + /** A test URI. */ private static final URI SERVICE_URI = URI.create("http://example.org/service"); + /** A test image info service. */ private static final ImageInfoService SERVICE = new ImageInfoService(SERVICE_URI); + /** A test image media type. */ private static final String IMAGE_PNG = "image/png"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/LayerTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/LayerTest.java index 2540d472..5eaaad40 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/LayerTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/LayerTest.java @@ -18,8 +18,10 @@ */ public class LayerTest { + /** A test value. */ private static final URI ID = URI.create("http://example.org/id"); + /** A test value. */ private static final String LABEL = "My great label"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestTest.java index 37057d6f..3247a90b 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestTest.java @@ -23,6 +23,7 @@ import info.freelibrary.iiif.presentation.v2.properties.ViewingHint; import info.freelibrary.iiif.presentation.v2.services.ImageInfoService; import info.freelibrary.iiif.presentation.v2.utils.Constants; + import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonObject; @@ -32,34 +33,50 @@ */ public class ManifestTest extends AbstractTest { + /** A test value. */ private static final String SINAI_JSON = "src/test/resources/json/z1960050.json"; + /** A test value. */ private static final String SERVER = "https://sinai-images.library.ucla.edu/iiif/"; + /** A test value. */ private static final String MANIFEST_ID = "ark:%2F21198%2Fz1960050"; + /** A test value. */ private static final String MANIFEST_URI = SERVER + MANIFEST_ID + "/manifest"; + /** A test value. */ private static final String SEQUENCE_URI = SERVER + MANIFEST_ID + "/sequence/sequence-0"; + /** A test value. */ private static final String THUMBNAIL_PATH = "/0,1022,6132,6132/150,150/0/default.jpg"; + /** A test value. */ private static final String MANIFEST_THUMBNAIL_URI = SERVER + "ark:%2F21198%2Fz1d79t3q" + THUMBNAIL_PATH; + /** A test value. */ private static final String LOGO_URI = "https://sinai-images.library.ucla.edu/images/logos/iiif_logo.png"; + /** A test value. */ private static final String TEST_TITLE = "Georgian NF Fragment 68a"; - private static final List METADATA_PAIRS = Stream.of(new String[] { "Title", TEST_TITLE }, - new String[] { "Extent", "1 f" }, new String[] { "Overtext Language", "Georgian" }, - new String[] { "Undertext Language(s)", "Christian Palestinian Aramaic" }).collect(Collectors.toList()); + /** A test value. */ + private static final List METADATA_PAIRS = Stream + .of(new String[] { "Title", TEST_TITLE }, new String[] { "Extent", "1 f" }, + new String[] { "Overtext Language", "Georgian" }, + new String[] { "Undertext Language(s)", "Christian Palestinian Aramaic" }) + .collect(Collectors.toList()); + /** A test height value. */ private static final int HEIGHT = 8176; + /** A test width value. */ private static final int WIDTH = 6132; + /** A test manifest. */ private Manifest myManifest; + /** A Vert.x instance. */ private Vertx myVertx; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestorTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestorTest.java index bce3bbfc..7b3adead 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestorTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/ManifestorTest.java @@ -1,7 +1,8 @@ package info.freelibrary.iiif.presentation.v2; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import java.io.File; import java.util.UUID; @@ -25,12 +26,16 @@ @RunWith(VertxUnitRunner.class) public class ManifestorTest { + /** A test manifest file. */ private static final File MANIFEST = new File("src/test/resources/json/z1960050.json"); + /** A test temporary directory. */ private static final File TMP_DIR = new File(System.getProperty("java.io.tmpdir")); + /** A test extension. */ private static final String JSON_EXT = ".json"; + /** A Vert.x instance. */ private Vertx myVertx; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/OtherContentTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/OtherContentTest.java index fe02c5b2..7be54a61 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/OtherContentTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/OtherContentTest.java @@ -17,10 +17,13 @@ */ public class OtherContentTest { + /** A test value. */ private static final URI ID = URI.create("http://example.org/id"); + /** A test canvas. */ private static final Canvas CANVAS = new Canvas("aaaa", "a label", 100, 100); + /** A test label. */ private static final Label LABEL = new Label("Label for " + ID); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/RangeTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/RangeTest.java index f8942be2..3a5d4ec1 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/RangeTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/RangeTest.java @@ -18,8 +18,10 @@ */ public class RangeTest { + /** A test URI. */ private static final URI ID = URI.create("http://example.org/id"); + /** A test label. */ private static final String LABEL = "My great label"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/ResourceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/ResourceTest.java index 521cba63..1c76e871 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/ResourceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/ResourceTest.java @@ -23,12 +23,16 @@ */ public class ResourceTest extends AbstractTest { + /** A test value. */ private static final String AAAA = "aaaa"; + /** A test value. */ private static final String BBBB = "bbbb"; + /** A test value. */ private static final String ASDF_JPG = "asdf.jpg"; + /** A test value. */ private static final String SILS_URL = "http://ils.unc.edu"; /** @@ -91,6 +95,9 @@ public void testMultiValues() throws MalformedURLException { */ class TestResource extends Resource { + /** + * Creates a new test resource. + */ TestResource() { super("fake", 1); } diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/SequenceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/SequenceTest.java index ceb86f1d..a829f4f8 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/SequenceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/SequenceTest.java @@ -19,8 +19,10 @@ */ public class SequenceTest { + /** A test value. */ private Canvas myCanvas; + /** A test value. */ private String myID; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/AttributionTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/AttributionTest.java index 28d8ca1e..6d1458c9 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/AttributionTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/AttributionTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -10,6 +10,7 @@ */ public class AttributionTest { + /** A test value. */ private static final String VALUE = "asdf"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/DescriptionTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/DescriptionTest.java index 41d04cd2..8c15f445 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/DescriptionTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/DescriptionTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -10,6 +10,7 @@ */ public class DescriptionTest { + /** A test value. */ private static final String VALUE = "asdf"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/I18nPropertyTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/I18nPropertyTest.java index b24610c6..e55eb88e 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/I18nPropertyTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/I18nPropertyTest.java @@ -1,7 +1,10 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.List; @@ -13,16 +16,22 @@ */ public class I18nPropertyTest { + /** A test value. */ private static final String ONE = "one"; + /** A test value. */ private static final String TWO = "two"; + /** A test value. */ private static final String THREE = "three"; + /** A test value. */ private static final String FOUR = "four"; + /** A test value. */ private static final String ENG = "eng"; + /** A test value. */ private static final String FRE = "fre"; /** @@ -61,7 +70,7 @@ public void testGetValues() { } /** - * Test of hashCode with double values + * Test of hashCode with double values. */ @Test public void testHashCodeDoubleValue() { @@ -72,7 +81,7 @@ public void testHashCodeDoubleValue() { } /** - * Test of hashCode with double values + * Test of hashCode with double values. */ @Test public void testHashCodeDifferentDoubleValue() { @@ -195,7 +204,7 @@ public void testGetValueSimple() { */ @Test public void testGetValueSimpleValueTwo() { - final List expected = Arrays.asList(new String[] { ONE, TWO }); + final List expected = Arrays.asList(ONE, TWO); assertEquals(expected, new I18nProperty<>(new Value(ONE), new Value(TWO)).getJsonValue()); } diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LabelTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LabelTest.java index 84adac98..1dc9fa49 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LabelTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LabelTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -17,14 +17,19 @@ */ public class LabelTest extends AbstractTest { + /** A test value. */ private static final String MANIFEST = "sc:Manifest"; + /** A test value. */ private static final String ASDF = "asdf"; + /** A test value. */ private static final String AAAA = "aaaa"; + /** A test manifest. */ private Manifest myManifest; + /** A test JSON object. */ private JsonObject myJSON; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LicenseTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LicenseTest.java index 5cada353..070c62c9 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LicenseTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LicenseTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; import java.net.URL; @@ -13,6 +13,7 @@ */ public class LicenseTest { + /** A license URL. */ private static final URL LICENSE_URL; static { diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LogoTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LogoTest.java index 05fbb7d5..a019e228 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LogoTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/LogoTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; @@ -12,33 +12,44 @@ import com.google.common.net.MediaType; +import info.freelibrary.util.StringUtils; + import info.freelibrary.iiif.presentation.v2.services.ImageInfoService; import info.freelibrary.iiif.presentation.v2.utils.TestUtils; -import info.freelibrary.util.StringUtils; /** * A logo test. */ public class LogoTest { + /** A test value. */ private static final URI LOGO_ID_1 = URI.create("http://example.org/images/logo1.jpg"); + /** A test value. */ private static final URI LOGO_ID_2 = URI.create("http://example.org/images/logo2.jpg"); + /** A test value. */ private static final String LOGO_SIMPLE_2 = "logo-simple-two.json"; + /** A test value. */ private static final String LOGO_ID_W_H = "logo-id-width-height.json"; + /** A test value. */ private static final String LOGO_IMAGE_SERVICE = "logo-string-imageinfoservice.json"; + /** A test value. */ private static final String LOGO_ID_W_H_DOUBLE = "logo-id-width-height-double.json"; + /** A test value. */ private static final String LOGO_ADD_IMAGE = "logo-addimage-string-imageinfoservice.json"; + /** A test value. */ private static final File TEST_DIR = new File("src/test/resources/json"); + /** A test value. */ private static final ImageInfoService SERVICE = new ImageInfoService("http://example.org/asdf"); + /** A test value. */ private static final String MIME_TYPE = "image/jpeg"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/MetadataTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/MetadataTest.java index 4c354c00..9bac8cb4 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/MetadataTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/MetadataTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; @@ -18,22 +18,31 @@ */ public class MetadataTest extends AbstractTest { + /** A test value. */ private static final String AAAA = "aaaa"; + /** A test value. */ private static final String BBBB = "bbbb"; + /** A test value. */ private static final String CCCC = "cccc"; + /** A test value. */ private static final String DDDD = "dddd"; + /** A test value. */ private static final String EEEE = "eeee"; + /** A test value. */ private static final String ENG = "eng"; + /** A test value. */ private static final String FRE = "fre"; + /** A test manifest. */ private Manifest myManifest; + /** A test JSON object. */ private JsonObject myJSON; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlsoTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlsoTest.java index f3f76838..9179ab33 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlsoTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/SeeAlsoTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.URI; import java.util.Optional; @@ -15,10 +15,13 @@ */ public class SeeAlsoTest { + /** A test URI. */ private static final URI URI_ONE = URI.create("http://www.example.org/one"); + /** A test URI. */ private static final URI URI_TWO = URI.create("http://www.example.org/two"); + /** A test media type. */ private static final MediaType MIME_TYPE = MediaType.parse("image/jpeg"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ThumbnailTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ThumbnailTest.java index 2567d30c..512e4a85 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ThumbnailTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ThumbnailTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; @@ -11,27 +11,34 @@ import com.fasterxml.jackson.core.JsonProcessingException; +import info.freelibrary.util.StringUtils; + import info.freelibrary.iiif.presentation.v2.services.ImageInfoService; import info.freelibrary.iiif.presentation.v2.utils.TestUtils; -import info.freelibrary.util.StringUtils; /** * A thumbnail test. */ public class ThumbnailTest { + /** A test URI. */ public static final URI THUMBNAIL_ID_1 = URI.create("http://example.org/images/book1-page1/full/80,100/0/default.jpg"); + /** A test URI. */ public static final URI PAGE_ID_1 = URI.create("http://example.org/images/book1-page1"); + /** A test URI. */ public static final URI THUMBNAIL_ID_2 = URI.create("http://example.org/images/book1-page2/full/80,100/0/default.jpg"); + /** A test URI. */ public static final URI PAGE_ID_2 = URI.create("http://example.org/images/book1-page2"); + /** A test file name. */ private static final String TN_FULL_SINGLE = "thumbnail-full-single.json"; + /** The test resources directory. */ private static final File TEST_DIR = new File("src/test/resources/json"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/TypeTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/TypeTest.java index 5ed5b106..9ed220ee 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/TypeTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/TypeTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -10,8 +10,10 @@ */ public class TypeTest { + /** A test type. */ private static final String ASDF = "asdf"; + /** A different test type. */ private static final String AAAA = "aaaa"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ValueTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ValueTest.java index 051084b8..6d67e88e 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ValueTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ValueTest.java @@ -1,7 +1,8 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -10,8 +11,10 @@ */ public class ValueTest { + /** A test language code. */ private static final String ENG = "eng"; + /** A test value. */ private static final String ONE = "one"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingDirectionTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingDirectionTest.java index 06329c5d..cc5dfc42 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingDirectionTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingDirectionTest.java @@ -16,6 +16,7 @@ */ public class ViewingDirectionTest { + /** A test logger. */ private static final Logger LOGGER = LoggerFactory.getLogger(ViewingDirection.class, MessageCodes.BUNDLE); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHintTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHintTest.java index 8ec36890..55053839 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHintTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/properties/ViewingHintTest.java @@ -1,7 +1,8 @@ package info.freelibrary.iiif.presentation.v2.properties; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.net.URI; @@ -14,14 +15,16 @@ */ public class ViewingHintTest { - private static final Option[] HINTS = new Option[] { Option.INDIVIDUALS, Option.PAGED, Option.CONTINUOUS, - Option.MULTIPART, Option.NONPAGED, Option.TOP, Option.FACINGPAGES }; + /** Expected hint keys. */ + private static final Option[] HINTS = { Option.INDIVIDUALS, Option.PAGED, Option.CONTINUOUS, Option.MULTIPART, + Option.NONPAGED, Option.TOP, Option.FACINGPAGES }; - private static final String[] VALUES = - new String[] { "individuals", "paged", "continuous", "multi-part", "non-paged", "top", "facing-pages" }; + /** Expected hint values. */ + private static final String[] VALUES = { "individuals", "paged", "continuous", "multi-part", "non-paged", // + "top", "facing-pages" }; - private static final URI[] URIS = - new URI[] { URI.create("http://library.unc.edu"), URI.create("http://library.ucla.edu") }; + /** Expected URIs. */ + private static final URI[] URIS = { URI.create("http://library.unc.edu"), URI.create("http://library.ucla.edu") }; /** * Tests that the enum values are what we expect them to be. @@ -41,7 +44,8 @@ public void testConstructor() { int index = 0; for (final ViewingHint.Value value : new ViewingHint(VALUES).getValues()) { - assertEquals(VALUES[index++], value.getString()); + assertEquals(VALUES[index], value.getString()); + index++; } } @@ -62,7 +66,8 @@ public void testGetOption() { for (final ViewingHint.Value value : new ViewingHint(URIS).getValues()) { assertTrue(value.isURI()); - assertEquals(URIS[index++], value.getURI()); + assertEquals(URIS[index], value.getURI()); + index++; } } diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevelTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevelTest.java index 8b2e1227..f3ce5617 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevelTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/services/APIComplianceLevelTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.services; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; import java.net.URI; @@ -15,10 +15,13 @@ */ public class APIComplianceLevelTest { + /** A test level. */ public static final String IMAGE_INFO_LEVEL_0 = "http://iiif.io/api/image/2/level0.json"; + /** A test level. */ public static final String IMAGE_INFO_LEVEL_1 = "http://iiif.io/api/image/2/level1.json"; + /** A test level. */ public static final String IMAGE_INFO_LEVEL_2 = "http://iiif.io/api/image/2/level2.json"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONServiceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONServiceTest.java index abe8dd18..296ed829 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONServiceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/services/GeoJSONServiceTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.services; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.URI; @@ -12,6 +12,7 @@ */ public class GeoJSONServiceTest { + /** A test value. */ private static final URI ID = URI.create("asdf"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/services/ImageInfoServiceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/services/ImageInfoServiceTest.java index 04eecde6..66919b15 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/services/ImageInfoServiceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/services/ImageInfoServiceTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.services; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.URI; @@ -12,8 +12,10 @@ */ public class ImageInfoServiceTest { + /** A test value. */ public static final URI CONTEXT = URI.create("http://iiif.io/api/image/2/context.json"); + /** A test value. */ private static final URI ID = URI.create("asdf"); /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/services/PhysicalDimsServiceTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/services/PhysicalDimsServiceTest.java index 10e9ff80..a9ebebd7 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/services/PhysicalDimsServiceTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/services/PhysicalDimsServiceTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.services; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.net.URI; @@ -12,10 +12,13 @@ */ public class PhysicalDimsServiceTest { + /** A test value. */ private static final URI ID = URI.create("asdf"); + /** A test value. */ private static final double SCALE = 4.123; + /** A test value. */ private static final String UNITS = "in"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/GenericTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/GenericTest.java index aaf79575..59b591e0 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/GenericTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/GenericTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.utils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.util.UUID; @@ -16,8 +16,10 @@ */ public class GenericTest { + /** A test value. */ private String myID; + /** A test value. */ private String myLabel; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializerTest.java b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializerTest.java index a55b6ce0..335ef95e 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializerTest.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/MetadataDeserializerTest.java @@ -1,7 +1,7 @@ package info.freelibrary.iiif.presentation.v2.utils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -16,20 +16,28 @@ */ public class MetadataDeserializerTest { + /** A test value. */ private static final String LABEL = "label"; + /** A test value. */ private static final String VALUE = "value"; + /** A test value. */ private static final String TITLE = "Title"; + /** A test value. */ private static final String EXTENT = "Extent"; + /** A test value. */ private static final String OVERTEXT = "Overtext Language"; + /** A test value. */ private static final String TEST_TITLE = "Georgian NF Fragment 68a"; + /** A test value. */ private static final String TEST_EXTENT = "1 f"; + /** A test value. */ private static final String TEST_OVERTEXT = "Georgian"; /** diff --git a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/TestUtils.java b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/TestUtils.java index 323eb5de..3b623ad3 100644 --- a/src/test/java/info/freelibrary/iiif/presentation/v2/utils/TestUtils.java +++ b/src/test/java/info/freelibrary/iiif/presentation/v2/utils/TestUtils.java @@ -11,7 +11,11 @@ */ public final class TestUtils { + /** + * Creates a new utilities class for the tests. + */ private TestUtils() { + // This is intentionally left empty } /**