    @Test
    public void testGenerate() throws Exception {

        final CascadingFieldsGenerator gen = new CascadingFieldsGenerator();
        final Schema schema = getSchema();

        final Writer writer = new StringWriter();
        gen.generate(schema, writer);
        writer.close();

        final String actual = writer.toString();
        final String expected = Resources.toString(getClass().getResource("expected.txt"), Charsets.UTF_8);

        assertEquals(expected, actual);
    }