added Unit test

added unit test
added static member function to Encoder