Home > Desarrollo, Librerías/Frameworks, Testing > Mockear métodos estáticos (y mas)

Mockear métodos estáticos (y mas)

Nota: Recientemente se ha publicado una nueva entrada que trata este mismo tema con mas detalle e incluyendo fragmentos de código fuente (en español). A continuación el artículo tal y como se publicó en su día:

What happens when you don’t have dependency injection and you’re using a third party library that contains classes of a certain vintage that contains static methods? One way is to isolate those classes by writing a wrapper or adaptor around them and using this to provide isolation during testing; however, there’s also another way: using PowerMock. PowerMock is a mocking framework that extends other mocking frameworks to provide much needed additional functionality. To para-phase an old advert: “it refreshes the parts that other mocking frameworks fail to reach”.

Read full post:

http://www.javacodegeeks.com/2011/11/mock-static-methods-with-powermock.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+JavaCodeGeeks+(Java+Code+Geeks)

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment