### Question:
DirectFileOutputDescriptionGenerator { public static void generate(EmitContext context, Description description) throws IOException { new DirectFileOutputDescriptionGenerator(context, description).emit(); } private  DirectFileOutputDescriptionGenerator(EmitContext context, Description description); static void generate(EmitContext context, Description description);  }### Answer:
@Test public void simple() { Class<? extends DirectFileOutputDescription> aClass = generate(new Description("Testing", name(MockData.class))); assertThat(DirectFileOutputDescription.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 DirectFileOutputDescription> aClass = generate(description); assertThat(DirectFileOutputDescription.class.isAssignableFrom(aClass), is(true)); assertThat(Modifier.isAbstract(aClass.getModifiers()), is(false)); DirectFileOutputDescription object = aClass.newInstance(); assertThat(object.getModelType(), is((Object) MockData.class)); assertThat(object.getBasePath(), is("base-path")); assertThat(object.getResourcePattern(), is("*")); assertThat(object.getOrder(), is(Collections.emptyList())); assertThat(object.getDeletePatterns(), is(Collections.emptyList())); assertThat(object.getFormat(), is((Object) MockDataFormat.class)); }
@Test public void w_all() throws Exception { Description description = new Description("Testing", name(MockData.class)); description.setBasePath("base-path"); description.setResourcePattern("*"); description.getOrder().add("something1"); description.getOrder().add("something2"); description.getDeletePatterns().add("delete1-*"); description.getDeletePatterns().add("delete2-*"); description.setFormatClassName(name(MockDataFormat.class)); Class<? extends DirectFileOutputDescription> aClass = generate(description); assertThat(DirectFileOutputDescription.class.isAssignableFrom(aClass), is(true)); assertThat(Modifier.isAbstract(aClass.getModifiers()), is(false)); DirectFileOutputDescription object = aClass.newInstance(); assertThat(object.getModelType(), is((Object) MockData.class)); assertThat(object.getBasePath(), is("base-path")); assertThat(object.getResourcePattern(), is("*")); assertThat(object.getOrder(), is(Arrays.asList("something1", "something2"))); assertThat(object.getDeletePatterns(), is(Arrays.asList("delete1-*", "delete2-*"))); assertThat(object.getFormat(), is((Object) MockDataFormat.class)); }