Skip to content
/ MockDemo Public

MockDemo 用Powermock实现的几种常用的单测场景。看完你就掌握了Powermock

Notifications You must be signed in to change notification settings

bjxg/MockDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MockDemo 用Powermock实现的几种常用的单测场景

  • 对本方法中外部对象的方法进行mock(详见:UserServiceImplMockTest.testAddUser())
  • 对本方法所在对象中的其它方法mock(详见:UserServiceImplMockTest.testGetUserByIDs())
  • 对静态方法进行mock(详见:ValidatorTest.testIsBlank())
  • 对构造方法的mock(详见:UserServiceImplMockTest.testGetUserByUsername())
  • 对私有方法的mock(详见:UserServiceImplMockTest.testGetUserByIDs())
  • 对静态代码块的mock(未实现)
  • 集成测试中的部分对象的mock(详见:UserServiceImplTest.testAddUserMock())

About

MockDemo 用Powermock实现的几种常用的单测场景。看完你就掌握了Powermock

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages