@@ -64,7 +64,33 @@ void testEmptyStream() throws Exception {
6464 assertEquals ("Binary data, ASCII Text Document" , results .get (DescriptionAction .KEY ));
6565 }
6666
67- public static Stream <Arguments > dataProvider () {
67+ public static Stream <Arguments > dataProviderVarious () {
68+ return Stream .of (
69+ arguments ("/various_types/test.png" , "image/png" , "Binary data, PNG image data, colormap," , "png" ),
70+ arguments ("/various_types/File-PNG_8pbc_GRAY.png" , "image/png" , "Binary data, PNG image data, grayscale," , "png" ),
71+ arguments ("/various_types/File-PNG_8bpc_RGBA.png" , "image/png" , "Binary data, PNG image data, \\ b/color RGBA," , "png" ),
72+ arguments ("/various_types/File-PNG_16bpc_RGBA.png" , "image/png" , "Binary data, PNG image data, \\ b/color RGBA," , "png" )
73+ );
74+ }
75+
76+ @ ParameterizedTest
77+ @ MethodSource ("dataProviderVarious" )
78+ void testVariousTypesExplicitly (String resource , String expectedMimeType , String expectedDescription , String expectedExtension ) throws Exception {
79+ final URL url = getClass ().getResource (resource );
80+ assertNotNull (url );
81+ final File file = new File (url .toURI ());
82+ final Map <String , Object > results = analyzer .analyze (file );
83+ printResult (results );
84+ assertNotNull (results , file + " could not be analyzed" );
85+ assertNotNull (results .get (MimeTypeAction .KEY ), "mimeType missing" );
86+ assertEquals (expectedMimeType , results .get (MimeTypeAction .KEY ), "wrong mimeType" );
87+ assertNotNull (results .get (DescriptionAction .KEY ), "description missing" );
88+ assertEquals (expectedDescription , results .get (DescriptionAction .KEY ), "wrong description" );
89+ assertNotNull (results .get (ExtensionAction .KEY ), "could not be analyzed" );
90+ assertEquals (expectedExtension , results .get (ExtensionAction .KEY ), "wrong extension" );
91+ }
92+
93+ public static Stream <Arguments > dataProviderXRechnung () {
6894 return Stream .of (
6995 arguments ("/various_types/BASIC_Einfach.pdf" , "application/pdf" ),
7096 arguments ("/various_types/EN16931_Einfach.pdf" , "application/pdf" ),
@@ -75,7 +101,7 @@ public static Stream<Arguments> dataProvider() {
75101 }
76102
77103 @ ParameterizedTest
78- @ MethodSource ("dataProvider " )
104+ @ MethodSource ("dataProviderXRechnung " )
79105 void testXRechnung (String resource , String expectedMimeType ) throws Exception {
80106 final URL url = getClass ().getResource (resource );
81107 assertNotNull (url );
0 commit comments