code generator and sample test
changed deprecated read to read!