Getting rid of more JUnit deprecation.

(cherry picked from commit 622c6f40d4049ba70d463b1fd0e214266a9b285d)
This commit is contained in:
Harald Kuhr 2020-10-13 19:29:58 +02:00 committed by Harald Kuhr
parent a06eb53cd2
commit 1ace3a6d5f
3 changed files with 28 additions and 16 deletions

View File

@ -31,8 +31,8 @@
package com.twelvemonkeys.imageio.spi;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
import org.junit.internal.matchers.TypeSafeMatcher;
import javax.imageio.ImageReader;
import javax.imageio.ImageWriter;
@ -63,52 +63,52 @@ public abstract class ReaderWriterProviderInfoTest {
}
@Test
public void readerClassName() throws Exception {
public void readerClassName() {
assertClassExists(providerInfo.readerClassName(), ImageReader.class);
}
@Test
public void readerSpiClassNames() throws Exception {
public void readerSpiClassNames() {
assertClassesExist(providerInfo.readerSpiClassNames(), ImageReaderSpi.class);
}
@Test
public void inputTypes() throws Exception {
public void inputTypes() {
assertNotNull(providerInfo.inputTypes());
}
@Test
public void writerClassName() throws Exception {
public void writerClassName() {
assertClassExists(providerInfo.writerClassName(), ImageWriter.class);
}
@Test
public void writerSpiClassNames() throws Exception {
public void writerSpiClassNames() {
assertClassesExist(providerInfo.writerSpiClassNames(), ImageWriterSpi.class);
}
@Test
public void outputTypes() throws Exception {
public void outputTypes() {
assertNotNull(providerInfo.outputTypes());
}
@Test
public void nativeStreamMetadataFormatClassName() throws Exception {
public void nativeStreamMetadataFormatClassName() {
assertClassExists(providerInfo.nativeStreamMetadataFormatClassName(), IIOMetadataFormat.class);
}
@Test
public void extraStreamMetadataFormatClassNames() throws Exception {
public void extraStreamMetadataFormatClassNames() {
assertClassesExist(providerInfo.extraStreamMetadataFormatClassNames(), IIOMetadataFormat.class);
}
@Test
public void nativeImageMetadataFormatClassName() throws Exception {
public void nativeImageMetadataFormatClassName() {
assertClassExists(providerInfo.nativeImageMetadataFormatClassName(), IIOMetadataFormat.class);
}
@Test
public void extraImageMetadataFormatClassNames() throws Exception {
public void extraImageMetadataFormatClassNames() {
assertClassesExist(providerInfo.extraImageMetadataFormatClassNames(), IIOMetadataFormat.class);
}
@ -116,7 +116,7 @@ public abstract class ReaderWriterProviderInfoTest {
public void formatNames() {
String[] names = providerInfo.formatNames();
assertNotNull(names);
assertFalse(names.length == 0);
assertNotEquals(0, names.length);
List<String> list = asList(names);
@ -133,7 +133,7 @@ public abstract class ReaderWriterProviderInfoTest {
public void suffixes() {
String[] suffixes = providerInfo.suffixes();
assertNotNull(suffixes);
assertFalse(suffixes.length == 0);
assertNotEquals(0, suffixes.length);
for (String suffix : suffixes) {
assertNotNull(suffix);
@ -145,7 +145,7 @@ public abstract class ReaderWriterProviderInfoTest {
public void mimeTypes() {
String[] mimeTypes = providerInfo.mimeTypes();
assertNotNull(mimeTypes);
assertFalse(mimeTypes.length == 0);
assertNotEquals(0, mimeTypes.length);
for (String mimeType : mimeTypes) {
assertNotNull(mimeType);

View File

@ -31,10 +31,11 @@
package com.twelvemonkeys.imageio.metadata;
import com.twelvemonkeys.imageio.stream.URLImageInputStreamSpi;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Test;
import org.junit.internal.matchers.TypeSafeMatcher;
import javax.imageio.ImageIO;
import javax.imageio.spi.IIORegistry;
@ -58,7 +59,7 @@ public abstract class MetadataReaderAbstractTest {
ImageIO.setUseCache(false);
}
protected final URL getResource(final String name) throws IOException {
protected final URL getResource(final String name) {
return getClass().getResource(name);
}

View File

@ -380,6 +380,7 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// photoshop|http://ns.adobe.com/photoshop/1.0/
Directory photoshop = getDirectoryByNS(compound, XMP.NS_PHOTOSHOP);
assertNotNull(photoshop);
assertEquals(3, photoshop.size());
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ColorMode"), hasValue("1"));
assertThat(photoshop.getEntryById("http://ns.adobe.com/photoshop/1.0/ICCProfile"), hasValue("Dot Gain 20%"));
@ -395,6 +396,8 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// xapMM|http://ns.adobe.com/xap/1.0/mm/
Directory mm = getDirectoryByNS(compound, XMP.NS_XAP_MM);
assertNotNull(mm);
assertEquals(3, mm.size());
assertThat(directory.getEntryById("http://ns.adobe.com/xap/1.0/mm/DocumentID"), hasValue("uuid:6DCA50CC7D53DD119F20F5A7EA4C9BEC"));
assertThat(directory.getEntryById("http://ns.adobe.com/xap/1.0/mm/InstanceID"), hasValue("uuid:6ECA50CC7D53DD119F20F5A7EA4C9BEC"));
@ -419,6 +422,8 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// dc|http://purl.org/dc/elements/1.1/
Directory dc = getDirectoryByNS(compound, XMP.NS_DC);
assertNotNull(dc);
assertEquals(1, dc.size());
assertThat(dc.getEntryById("http://purl.org/dc/elements/1.1/format"), hasValue("image/jpeg"));
@ -433,6 +438,8 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// tiff|http://ns.adobe.com/tiff/1.0/
Directory tiff = getDirectoryByNS(compound, XMP.NS_TIFF);
assertNotNull(tiff);
assertEquals(5, tiff.size());
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/Orientation"), hasValue("1"));
assertThat(tiff.getEntryById("http://ns.adobe.com/tiff/1.0/XResolution"), hasValue("720000/10000"));
@ -450,6 +457,8 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// xap|http://ns.adobe.com/xap/1.0/
Directory xap = getDirectoryByNS(compound, XMP.NS_XAP);
assertNotNull(xap);
assertEquals(4, xap.size());
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/ModifyDate"), hasValue("2008-07-16T14:44:49-07:00"));
assertThat(xap.getEntryById("http://ns.adobe.com/xap/1.0/CreatorTool"), hasValue("Adobe Photoshop CS3 Windows"));
@ -466,6 +475,8 @@ public class XMPReaderTest extends MetadataReaderAbstractTest {
// exif|http://ns.adobe.com/exif/1.0/
Directory exif = getDirectoryByNS(compound, XMP.NS_EXIF);
assertNotNull(exif);
assertEquals(4, exif.size());
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/ColorSpace"), hasValue("-1")); // SIC. Same as unsigned short 65535, meaning "uncalibrated"?
assertThat(exif.getEntryById("http://ns.adobe.com/exif/1.0/PixelXDimension"), hasValue("426"));