add unit tests for writer class