Java Code Examples for org.mockito.Matchers#argThat()

The following examples show how to use org.mockito.Matchers#argThat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BugInstanceMatcherBuilder.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * @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));
}
 
Example 2
Source File: MessageMatchers.java    From Jabit with Apache License 2.0 6 votes vote down vote up
public static ObjectMessage object(final ObjectType type) {
    return Matchers.argThat(new BaseMatcher<ObjectMessage>() {
        @Override
        public boolean matches(Object item) {
            return item instanceof ObjectMessage && ((ObjectMessage) item).getPayload().getType() == type;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("payload type should be ").appendValue(type);
        }
    });
}
 
Example 3
Source File: MessageMatchers.java    From Jabit with Apache License 2.0 5 votes vote down vote up
public static Plaintext plaintext(final Plaintext.Type type) {
    return Matchers.argThat(new BaseMatcher<Plaintext>() {
        @Override
        public boolean matches(Object item) {
            return item instanceof Plaintext && ((Plaintext) item).getType() == type;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("type should be ").appendValue(type);
        }
    });
}
 
Example 4
Source File: EnvironmentModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static EnvironmentModel equals(EnvironmentModel expected) {
    return Matchers.argThat(new EnvironmentModelMatcher(expected));
}
 
Example 5
Source File: LightModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static LightModel lightModelEq(LightModel expected) {
    return Matchers.argThat(new LightModelMatcher(expected));
}
 
Example 6
Source File: ScenarioModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static ScenarioModel scenarioModelEq(ScenarioModel expected) {
    return Matchers.argThat(new ScenarioModelMatcher(expected));
}
 
Example 7
Source File: IpcamModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static IpcamModel ipcamModelEq(IpcamModel expected) {
    return Matchers.argThat(new IpcamModelMatcher(expected));
}
 
Example 8
Source File: TemperatureModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static TemperatureModel temperatureModelEq(TemperatureModel expected) {
    return Matchers.argThat(new TemperatureModelMatcher(expected));
}
 
Example 9
Source File: EnergyModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static EnergyModel energyModelEq(EnergyModel expected) {
    return Matchers.argThat(new EnergyModelMatcher(expected));
}
 
Example 10
Source File: AutomationModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static AutomationModel automationModelEq(AutomationModel expected) {
    return Matchers.argThat(new AutomationModelMatcher(expected));
}
 
Example 11
Source File: SoundModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static SoundModel soundModelEq(SoundModel expected) {
    return Matchers.argThat(new SoundModelMatcher(expected));
}
 
Example 12
Source File: DeviceModelMatcher.java    From openwebnet-android with MIT License 4 votes vote down vote up
public static DeviceModel equalsTo(DeviceModel expected) {
    return Matchers.argThat(new DeviceModelMatcher(expected));
}
 
Example 13
Source File: RejectLargeMailTest.java    From mireka with Apache License 2.0 4 votes vote down vote up
private MailData exampleSimpleMail() {
    return Matchers.argThat(new MailDataWithSameContent(ExampleMailData
            .simple()));
}