本文整理匯總了Java中org.mockito.Matchers.argThat方法的典型用法代碼示例。如果您正苦於以下問題:Java Matchers.argThat方法的具體用法?Java Matchers.argThat怎麽用?Java Matchers.argThat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mockito.Matchers
的用法示例。
在下文中一共展示了Matchers.argThat方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: build
import org.mockito.Matchers; //導入方法依賴的package包/類
/**
* @return Mockito Matcher
*/
public BugInstance build() {
//JSP line to Java source conversion
List<Integer> multipleChoicesLine = null;
if(jspLine != null) {
if(jspFile != null) {
//Map JSP lines to Java base on the smap file if available
multipleChoicesLine = mapJspToJavaLine(jspFile,jspLine);
}
else {
throw new RuntimeException("JSP file not set.");
}
}
return Matchers.argThat(new BugInstanceMatcher(bugType, className, methodName, fieldName, lineNumber, lineNumberApprox, priority, jspFile, multipleChoicesLine));
}
示例2: ownershipChange
import org.mockito.Matchers; //導入方法依賴的package包/類
static DOMEntityOwnershipChange ownershipChange(final DOMEntity expEntity, final boolean expWasOwner,
final boolean expIsOwner, final boolean expHasOwner, final boolean expInJeopardy) {
return Matchers.argThat(new ArgumentMatcher<DOMEntityOwnershipChange>() {
@Override
public boolean matches(Object argument) {
DOMEntityOwnershipChange change = (DOMEntityOwnershipChange) argument;
return expEntity.equals(change.getEntity()) && expWasOwner == change.getState().wasOwner()
&& expIsOwner == change.getState().isOwner() && expHasOwner == change.getState().hasOwner()
&& expInJeopardy == change.inJeopardy();
}
@Override
public void describeTo(Description description) {
description.appendValue(new DOMEntityOwnershipChange(expEntity, EntityOwnershipChangeState.from(
expWasOwner, expIsOwner, expHasOwner), expInJeopardy));
}
});
}
示例3: updateElectionTerm
import org.mockito.Matchers; //導入方法依賴的package包/類
static UpdateElectionTerm updateElectionTerm(final long term, final String votedFor) {
return Matchers.argThat(new ArgumentMatcher<UpdateElectionTerm>() {
@Override
public boolean matches(Object argument) {
UpdateElectionTerm other = (UpdateElectionTerm) argument;
return term == other.getCurrentTerm() && votedFor.equals(other.getVotedFor());
}
@Override
public void describeTo(Description description) {
description.appendValue(new UpdateElectionTerm(term, votedFor));
}
});
}
示例4: domDataTreeIdentifier
import org.mockito.Matchers; //導入方法依賴的package包/類
static DOMDataTreeIdentifier domDataTreeIdentifier(final YangInstanceIdentifier yangID) {
return Matchers.argThat(new ArgumentMatcher<DOMDataTreeIdentifier>() {
@Override
public boolean matches(final Object argument) {
final DOMDataTreeIdentifier treeId = (DOMDataTreeIdentifier) argument;
return (treeId.getDatastoreType() == LogicalDatastoreType.CONFIGURATION) &&
yangID.equals(treeId.getRootIdentifier());
}
@Override
public void describeTo(final Description description) {
description.appendValue(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, yangID));
}
});
}