@@ -64,7 +64,32 @@ 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/iworks_pages_file.pages" , "application/vnd.apple.pages" , "Apple Pages Document" , "pages" ),
70+ arguments ("/various_types/iworks_numbers_file.numbers" , "application/vnd.apple.numbers" , "Apple Numbers Document" , "numbers" ),
71+ arguments ("/various_types/iworks_keynote_file.key" , "application/vnd.apple.keynote" , "Apple Keynote Document" , "key" )
72+ );
73+ }
74+
75+ @ ParameterizedTest
76+ @ MethodSource ("dataProviderVarious" )
77+ void testVariousTypesExplicitly (String resource , String expectedMimeType , String expectedDescription , String expectedExtension ) throws Exception {
78+ final URL url = getClass ().getResource (resource );
79+ assertNotNull (url );
80+ final File file = new File (url .toURI ());
81+ final Map <String , Object > results = analyzer .analyze (file );
82+ printResult (results );
83+ assertNotNull (results , file + " could not be analyzed" );
84+ assertNotNull (results .get (MimeTypeAction .KEY ), "mimeType missing" );
85+ assertEquals (expectedMimeType , results .get (MimeTypeAction .KEY ), "wrong mimeType" );
86+ assertNotNull (results .get (DescriptionAction .KEY ), "description missing" );
87+ assertEquals (expectedDescription , results .get (DescriptionAction .KEY ), "wrong description" );
88+ assertNotNull (results .get (ExtensionAction .KEY ), "could not be analyzed" );
89+ assertEquals (expectedExtension , results .get (ExtensionAction .KEY ), "wrong extension" );
90+ }
91+
92+ public static Stream <Arguments > dataProviderXRechnung () {
6893 return Stream .of (
6994 arguments ("/various_types/BASIC_Einfach.pdf" , "application/pdf" ),
7095 arguments ("/various_types/EN16931_Einfach.pdf" , "application/pdf" ),
@@ -75,7 +100,7 @@ public static Stream<Arguments> dataProvider() {
75100 }
76101
77102 @ ParameterizedTest
78- @ MethodSource ("dataProvider " )
103+ @ MethodSource ("dataProviderXRechnung " )
79104 void testXRechnung (String resource , String expectedMimeType ) throws Exception {
80105 final URL url = getClass ().getResource (resource );
81106 assertNotNull (url );
@@ -109,7 +134,7 @@ private void ensureXRechnungIsTrue(final Map<String, Object> results, final Stri
109134 }
110135
111136
112- private static void printResult (final Map <String , Object > results ) {
137+ public static void printResult (final Map <String , Object > results ) {
113138 for (final Map .Entry <String , Object > e : results .entrySet ()) {
114139 LOGGER .info (" {}={}" , e .getKey (), e .getValue ());
115140 }
0 commit comments