mocking - Supressing or Whiteboxing issue -
i have logger private static final utilizes server. suppress logger method debug, or suppress , interactions variable. declare logger in loggingclass
private static final logger logger = loggerfactory.getlogger("loggingclass");
the javadoc debug :
public abstract void debug(string s, object aobj[]);
in test class have tried:
powermockito.suppress(powermockito.method(logger.class, "debug", string.class, object[].class));
problem : throws toomanymethodsexception
===========
logger nulllogger= null; loggingclass lc= new loggingclass(); //this class uses logger whitebox.setinternalstate(lc, "logger",nulllogger);
problem: throws whitebox can not find instance field logger.
any assistance appreicated
try below
suppress(everythingdeclaredin(loggerfactory.class));
the import statements are
import static org.powermock.api.support.membermodification.membermatcher.everythingdeclaredin; import static org.powermock.api.support.membermodification.membermodifier.suppress;
Comments
Post a Comment