java - EasyMock - Creating mock of singleton created with enum -


i'm generating unit tests project, , have singleton class looks this

public enum myenum{   instance;    public string dosomething(string name){       return "my name "+name;   } } 

this how trying unit test

@test public void test(){     string name = "nacho";     string expectedresult = "my name nacho";     string resulttosend = "my name nacho";     myenum singletonmock = createnicemock(myenum.class); //line     expect(singletonmock.dosomething(name)).andreturn(resulttosend);     replay(singletonmock);     string actualresponse = singleton.dosomething(mock);     assertequals(actualresponse, expectedresponse); }  

i know pointless test, bare me. problem on line a, runtime error saying "cannot subclass final class class myenum", , know it's because enums final.

any ideas?


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -