@Test( expected = IllegalArgumentException.class ) public void shouldFailForInvalidConfigurationValue() { MimeTypeDetectors.createDetectorFor("test", environment); }
public static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment) { switch (mimeTypeDetectionConfig.toLowerCase()) { case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT: { return TIKA_AVAILABLE ? new TikaContentDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME: { return TIKA_AVAILABLE ? new TikaNameOnlyDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE: { return NullMimeTypeDetector.INSTANCE; } default: { throw new IllegalArgumentException("Unknown mime-type detector setting: " + mimeTypeDetectionConfig); } } }
MimeTypeDetectors { public static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment) { switch (mimeTypeDetectionConfig.toLowerCase()) { case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT: { return TIKA_AVAILABLE ? new TikaContentDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME: { return TIKA_AVAILABLE ? new TikaNameOnlyDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE: { return NullMimeTypeDetector.INSTANCE; } default: { throw new IllegalArgumentException("Unknown mime-type detector setting: " + mimeTypeDetectionConfig); } } } }
MimeTypeDetectors { public static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment) { switch (mimeTypeDetectionConfig.toLowerCase()) { case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT: { return TIKA_AVAILABLE ? new TikaContentDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME: { return TIKA_AVAILABLE ? new TikaNameOnlyDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE: { return NullMimeTypeDetector.INSTANCE; } default: { throw new IllegalArgumentException("Unknown mime-type detector setting: " + mimeTypeDetectionConfig); } } } private  MimeTypeDetectors(); }
MimeTypeDetectors { public static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment) { switch (mimeTypeDetectionConfig.toLowerCase()) { case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT: { return TIKA_AVAILABLE ? new TikaContentDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME: { return TIKA_AVAILABLE ? new TikaNameOnlyDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE: { return NullMimeTypeDetector.INSTANCE; } default: { throw new IllegalArgumentException("Unknown mime-type detector setting: " + mimeTypeDetectionConfig); } } } private  MimeTypeDetectors(); static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment); }
MimeTypeDetectors { public static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment) { switch (mimeTypeDetectionConfig.toLowerCase()) { case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT: { return TIKA_AVAILABLE ? new TikaContentDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME: { return TIKA_AVAILABLE ? new TikaNameOnlyDetector(environment) : new DefaultMimeTypeDetector(); } case RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE: { return NullMimeTypeDetector.INSTANCE; } default: { throw new IllegalArgumentException("Unknown mime-type detector setting: " + mimeTypeDetectionConfig); } } } private  MimeTypeDetectors(); static MimeTypeDetector createDetectorFor(String mimeTypeDetectionConfig, Environment environment);  }