當前位置: 首頁>>代碼示例>>Java>>正文


Java Matchers.argThat方法代碼示例

本文整理匯總了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));
}
 
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:20,代碼來源:BugInstanceMatcherBuilder.java

示例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));
        }
    });
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:19,代碼來源:AbstractEntityOwnershipTest.java

示例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));
        }
    });
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:15,代碼來源:RaftActorRecoverySupportTest.java

示例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));
        }
    });
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:16,代碼來源:BindingDOMDataTreeChangeServiceAdapterTest.java


注:本文中的org.mockito.Matchers.argThat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。