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)

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: