From 0b566c0405424890b8e3f10d991f327af6922219 Mon Sep 17 00:00:00 2001 From: ogawaffm Date: Mon, 26 Aug 2024 09:44:14 +0200 Subject: [PATCH] Fix of #676 --- Source/com/drew/imaging/FileType.java | 6 +++--- Tests/com/drew/imaging/FileTypeTest.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/com/drew/imaging/FileType.java b/Source/com/drew/imaging/FileType.java index 9914ac50c..44a4c8a33 100644 --- a/Source/com/drew/imaging/FileType.java +++ b/Source/com/drew/imaging/FileType.java @@ -71,7 +71,7 @@ public enum FileType // Only file detection Aac("AAC", "Advanced Audio Coding", "audio/aac", "m4a"), Asf("ASF", "Advanced Systems Format", "video/x-ms-asf", "asf", "wma", "wmv"), - Cfbf("CFBF", "Compound File Binary Format", null, (String[])null), + Cfbf("CFBF", "Compound File Binary Format", null), Flv("FLV", "Flash Video", "video/x-flv", ".flv", ".f4v,"), Indd("INDD", "INDesign Document", "application/octet-stream", ".indd"), Mxf("MXF", "Material Exchange Format", "application/mxf", "mxf"), @@ -88,9 +88,9 @@ public enum FileType @NotNull private final String _name; @NotNull private final String _longName; @Nullable private final String _mimeType; - private final String[] _extensions; + @NotNull private final String[] _extensions; - FileType(@NotNull String name, @NotNull String longName, @Nullable String mimeType, String... extensions) + FileType(@NotNull String name, @NotNull String longName, @Nullable String mimeType, @NotNull String... extensions) { _name = name; _longName = longName; diff --git a/Tests/com/drew/imaging/FileTypeTest.java b/Tests/com/drew/imaging/FileTypeTest.java index 5ca58e180..09201a38e 100644 --- a/Tests/com/drew/imaging/FileTypeTest.java +++ b/Tests/com/drew/imaging/FileTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 Drew Noakes and contributors + * Copyright 2002-2024 Drew Noakes and contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; public class FileTypeTest @@ -41,4 +42,13 @@ public void testExtensions() assertNull(FileType.Unknown.getCommonExtension()); } + + @Test + public void testCommonExtension() + { + for (FileType fileType : FileType.values()) { + String[] extensions = fileType.getAllExtensions(); + assertNotNull(fileType.name(), extensions); + } + } }