@Test
@SuppressWarnings("unchecked")
public void isFileFormat() {

    // Mock delegate
    final SparkDataSetDelegate<DataFrame> delegate = Mockito.mock(SparkDataSetDelegate.class);
    Mockito.when(delegate.isFileFormat(Mockito.any(Class.class))).then(new Answer<Boolean>() {
        @Nonnull
        @Override
        public Boolean answer(@Nonnull final InvocationOnMock invocation) {
            final Class<?> clazz = invocation.getArgumentAt(0, Class.class);
            return HadoopFsRelationProvider.class.isAssignableFrom(clazz);
        }
    });
    // Test invalid format
    final DataSetOptions options = new DataSetOptions();
    options.setFormat("invalid");
    final KyloCatalogClient<DataFrame> client = Mockito.mock(KyloCatalogClient.class);
    SparkDataSetContext<DataFrame> context = new SparkDataSetContext<>(options, client, delegate);
    Assert.assertFalse("Expected 'invalid' to not be a file format", context.isFileFormat());
    // Test non-file format
    options.setFormat("jdbc");
    context = new SparkDataSetContext<>(options, client, delegate);
    Assert.assertFalse("Expected 'jdbc' to not be a file format", context.isFileFormat());
    // Test short name
    options.setFormat("text");
    context = new SparkDataSetContext<>(options, client, delegate);
    Assert.assertTrue("Expected 'text' to be a file format", context.isFileFormat());
    // Test class name
    options.setFormat("org.apache.spark.sql.execution.datasources.text.DefaultSource");
    context = new SparkDataSetContext<>(options, client, delegate);
    Assert.assertTrue("Expected 'org.apache.spark.sql.execution.datasources.text.DefaultSource' to be a file format", context.isFileFormat());
    // Test package name
    options.setFormat("org.apache.spark.sql.execution.datasources.text");
    context = new SparkDataSetContext<>(options, client, delegate);
    Assert.assertTrue("Expected 'org.apache.spark.sql.execution.datasources.text' to be a file format", context.isFileFormat());
}