Hi all,
I have a question about how to do JClouds mock test.
My target codes are showing as below.
ComputeServiceContext context = ContextBuilder.newBuilder(provider)
.endpoint(endpoint.get())
.credentials(identity.get(),
password.get()).modules(modules)
.buildView(ComputeServiceContext.class);
RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
compute = context.getComputeService();
novaApi = nova.getApi();
And I knew that I can mock ComputeService with following codes.
ComputeServiceContext context =
ContextBuilder.newBuilder("stub").buildView(ComputeServiceContext.class) ;
compute = context.getComputeService();
But how can I mock novaApi?
When I tried to call following codes, it always said to me
"java.lang.ClassCastException: org.jclouds.internal.ContextImpl cannot be
cast to org.jclouds.rest.RestContext"
RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
Is there anyone aware of any solution?
Thanks in advance,
Xianyi Ye