@Test
    public void shouldReturnAssignedImports() throws Exception {
        final Method abs = Math.class.getMethod("abs", double.class);
        final Enum dayOfWeekEnum = DayOfWeek.SATURDAY;
        final Enum tEnum = T.id;
        final Field fieldLabels = WithOptions.class.getDeclaredField("labels");

        final ImportCustomizer imports = DefaultImportCustomizer.build()
                .addClassImports(java.awt.Color.class, java.awt.AlphaComposite.class)
                .addFieldImports(fieldLabels)
                .addMethodImports(abs)
                .addEnumImports(dayOfWeekEnum, tEnum).create();

        assertEquals(2, imports.getClassImports().size());
        assertThat(imports.getClassImports(), hasItems(java.awt.Color.class, java.awt.AlphaComposite.class));
        assertEquals(1, imports.getClassPackages().size());
        assertThat(imports.getClassPackages(), hasItems(java.awt.Color.class.getPackage()));

        assertEquals(1, imports.getMethodImports().size());
        assertThat(imports.getMethodImports(), hasItems(abs));
        assertEquals(1, imports.getMethodClasses().size());
        assertThat(imports.getMethodClasses(), hasItems(Math.class));

        assertEquals(2, imports.getEnumImports().size());
        assertThat(imports.getEnumImports(), hasItems(dayOfWeekEnum, tEnum));
        assertEquals(2, imports.getEnumClasses().size());
        assertThat(imports.getEnumClasses(), hasItems(T.class, DayOfWeek.class));

        assertEquals(1, imports.getFieldImports().size());
        assertThat(imports.getFieldImports(), hasItems(fieldLabels));
        assertEquals(1, imports.getFieldClasses().size());
        assertThat(imports.getFieldClasses(), hasItems(WithOptions.class));
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/DefaultImportCustomizerTest.java