org.mockito.internal.matchers.CompareTo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of securemock Show documentation
Show all versions of securemock Show documentation
Libraries for Elasticsearch
The newest version!
/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.matchers;
import org.mockito.ArgumentMatcher;
import java.io.Serializable;
public abstract class CompareTo> implements ArgumentMatcher, Serializable {
private final T wanted;
public CompareTo(T value) {
this.wanted = value;
}
@Override
public final boolean matches(T actual) {
if (actual == null) {
return false;
}
if (!actual.getClass().isInstance(wanted)){
return false;
}
int result = actual.compareTo(wanted);
return matchResult(result);
}
@Override
public final String toString() {
return getName() + "(" + wanted + ")";
}
protected abstract String getName();
protected abstract boolean matchResult(int result);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy