### Question:
DirectFileInputDescriptionGenerator { public static void generate(EmitContext context, Description description) throws IOException { new DirectFileInputDescriptionGenerator(context, description).emit(); } private  DirectFileInputDescriptionGenerator(EmitContext context, Description description); static void generate(EmitContext context, Description description);  }### Answer:
@Test public void simple() { Class<? extends DirectFileInputDescription> aClass = generate(new Description("Testing", name(MockData.class))); assertThat(DirectFileInputDescription.class.isAssignableFrom(aClass), is(true)); assertThat(Modifier.isAbstract(aClass.getModifiers()), is(true)); assertThat(aClass, hasGetter("getModelType")); assertThat(aClass, not(hasGetter("getBasePath"))); assertThat(aClass, not(hasGetter("getResourcePattern"))); assertThat(aClass, not(hasGetter("getFormat"))); }
@Test public void concrete() throws Exception { Description description = new Description("Testing", name(MockData.class)); description.setBasePath("base-path"); description.setResourcePattern("*"); description.setFormatClassName(name(MockDataFormat.class)); Class<? extends DirectFileInputDescription> aClass = generate(description); assertThat(DirectFileInputDescription.class.isAssignableFrom(aClass), is(true)); assertThat(Modifier.isAbstract(aClass.getModifiers()), is(false)); DirectFileInputDescription object = aClass.newInstance(); assertThat(object.getModelType(), is((Object) MockData.class)); assertThat(object.getBasePath(), is("base-path")); assertThat(object.getResourcePattern(), is("*")); assertThat(object.getFormat(), is((Object) MockDataFormat.class)); assertThat(object.isOptional(), is(false)); assertThat(object.getDataSize(), is(DataSize.UNKNOWN)); }
@Test public void w_all() throws Exception { Description description = new Description("Testing", name(MockData.class)); description.setBasePath("base-path"); description.setResourcePattern("*"); description.setOptional(true); description.setDataSize(DataSize.TINY); description.setFormatClassName(name(MockDataFormat.class)); Class<? extends DirectFileInputDescription> aClass = generate(description); assertThat(DirectFileInputDescription.class.isAssignableFrom(aClass), is(true)); assertThat(Modifier.isAbstract(aClass.getModifiers()), is(false)); DirectFileInputDescription object = aClass.newInstance(); assertThat(object.getModelType(), is((Object) MockData.class)); assertThat(object.getBasePath(), is("base-path")); assertThat(object.getResourcePattern(), is("*")); assertThat(object.getFormat(), is((Object) MockDataFormat.class)); assertThat(object.isOptional(), is(true)); assertThat(object.getDataSize(), is(DataSize.TINY)); }