本文整理汇总了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));
}
});
}