Using reflection to change static final File.separatorChar for unit testing?

前端 未结 7 905
太阳男子
太阳男子 2020-11-28 09:37

Specifically, I\'m trying to create a unit test for a method which requires uses File.separatorChar to build paths on windows and unix. The code must run on bot

7条回答
  •  庸人自扰
    2020-11-28 09:42

    I realise this doesn't answer your question directly, but Apache Commons FileNameUtils will do cross-platform filename construction, and may save you writing your own class to do this.

提交回复
热议问题