I have tried with:
@PrepareForTest(HifiAccess.class)
but I get the same error....
br,
//mike
On 21 Feb, 18:20, Johan Haleby <
johan.hal...@gmail.com> wrote:
> You're using "PowerMockito.mockStatic(HifiAccess.class);" but HifiAccess is
> not included in the @PrepareForTest annotation.
>
> /Johan
>
>
>
> On Thu, Feb 21, 2013 at 5:59 PM, mike <
mikaelpetters...@gmail.com> wrote:
> > Hi,
>
> > I am not sure what you mean by that? I have a:
>
> > MockitTo.when(HifiAccess.method()) ....
>
> > Later in method. Or do you mean something else?
>
> > br,
>
> > //mike
> > Den torsdagen den 21:e februari 2013 kl. 16:38:56 UTC+1 skrev Johan Haleby:
>
> >> You haven't prepared "HifiAccess" for test?
>
> >> /Johan
>
> >> On Thu, Feb 21, 2013 at 3:03 PM, mike <
mikaelpe...@gmail.com> wrote:
>
> >>> Hi,
>
> >>> I am using the following in my pom.xml
>
> >>> <mockito-all.version>1.9.0-**rc1</mockito-all.version>
> >>> <powermock.version>1.4.12</**powermock.version>
>
> >>> <dependency>
> >>> <groupId>junit</groupId>
> >>> <artifactId>junit</artifactId>
> >>> <version>4.10</version>
> >>> <scope>test</scope>
> >>> </dependency>
> >>> <dependency>
> >>> <groupId>org.mockito</groupId>
> >>> <artifactId>mockito-all</**artifactId>
> >>> <version>${mockito-all.**version}</version>
> >>> <scope>test</scope>
> >>> </dependency>
> >>> <dependency>
> >>> <groupId>org.powermock</**groupId>
> >>> <artifactId>powermock-api-**mockito</artifactId>
> >>> <version>${powermock.version}<**/version>
> >>> <scope>test</scope>
> >>> </dependency>
> >>> <dependency>
> >>> <groupId>org.powermock</**groupId>
> >>> <artifactId>powermock-module-**
> >>> junit4</artifactId>
> >>> <version>${powermock.version}<**/version>
> >>> <scope>test</scope>
> >>> </dependency>
>
> >>> This is my testcase ( not all code):
>
> >>> import org.junit.runner.RunWith;
> >>> import org.mockito.Mockito;
> >>> import org.powermock.api.mockito.**PowerMockito;
> >>> import org.powermock.core.**classloader.annotations.**PrepareForTest;
> >>> import org.powermock.modules.junit4.**PowerMockRunner;
>
> >>> @RunWith(PowerMockRunner.**class)
> >>> @PrepareForTest(NodeAccess.**class)
> >>> public class MyTest {
>
> >>> @Test
> >>> public void test() throws Exception{
>
> >>> //Mock static
> >>> PowerMockito.mockStatic(**HifiAccess.class);
>
> >>> .....
>
> >>> }
>
> >>> I execute the test within eclipse ide.
> >>> Any ideas why this is not working and I get the error message when I
> >>> run the testcase?
>
> >>> java.lang.**IllegalArgumentException: Cannot subclass final class
> >>> HifiAccess.class
>
> >>> //mike
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "PowerMock" group.
> >>> To unsubscribe from this group and stop receiving emails from it, send
> >>> an email to powermock+...@**
googlegroups.com.
> >>> Visit this group athttp://
groups.google.com/**group/powermock?hl=en<
http://groups.google.com/group/powermock?hl=en>
> >>> .
> >>> For more options, visithttps://
groups.google.com/**groups/opt_out<
https://groups.google.com/groups/opt_out>
> >>> .