Bumped dependency versions
This commit is contained in:
@ -24,10 +24,10 @@ artifacts {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.slf4j:slf4j-api:1.7.12'
|
||||
compile 'org.slf4j:slf4j-api:1.7.25'
|
||||
compile 'ch.dissem.msgpack:msgpack:1.0.0'
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
||||
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||
testCompile 'org.mockito:mockito-core:2.7.21'
|
||||
testCompile project(':cryptography-bc')
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import static ch.dissem.bitmessage.entity.Plaintext.Type.MSG;
|
||||
import static ch.dissem.bitmessage.utils.TestUtils.RANDOM;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -19,38 +19,27 @@ package ch.dissem.bitmessage.utils;
|
||||
import ch.dissem.bitmessage.entity.ObjectMessage;
|
||||
import ch.dissem.bitmessage.entity.Plaintext;
|
||||
import ch.dissem.bitmessage.entity.payload.ObjectType;
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.mockito.Matchers;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
|
||||
/**
|
||||
* @author Christian Basler
|
||||
*/
|
||||
public class MessageMatchers {
|
||||
public static Plaintext plaintext(final Plaintext.Type type) {
|
||||
return Matchers.argThat(new BaseMatcher<Plaintext>() {
|
||||
return ArgumentMatchers.argThat(new ArgumentMatcher<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);
|
||||
public boolean matches(Plaintext item) {
|
||||
return item != null && item.getType() == type;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ObjectMessage object(final ObjectType type) {
|
||||
return Matchers.argThat(new BaseMatcher<ObjectMessage>() {
|
||||
return ArgumentMatchers.argThat(new ArgumentMatcher<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);
|
||||
public boolean matches(ObjectMessage item) {
|
||||
return item != null && item.getPayload().getType() == type;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user