0

Is there any way to stub a static method using Arquillian with Junit? Example:

class A {
 public static String methodA() {
  if(...){
   return "Real";
  }
  return "Stub";
 }
}

class B {
 public String methodB(){
  String test = A.methodA();
  if(test.equals("Real"){
    // some code here
  } else {
    // some code here
  }
 }
}

I need to test methodB() without executing methodA, with stubbing it and expecting its result, is it possible?

Thank you.

callafa
  • 385
  • 2
  • 6
  • 20

1 Answers1

0

I don't think that Arquillian itself can do this, you need something else like PowerMock as well. So your question is a duplicate of this questions of sorts.

Community
  • 1
  • 1
Hardy
  • 18,659
  • 3
  • 49
  • 65