blob: bcc02e1f4db6e5aa414fb609e31da8b600906671 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.matchers;
import com.yahoo.vespa.clustercontroller.core.Event;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
public class EventTimeIs extends BaseMatcher<Event> {
private final long expected;
private EventTimeIs(long expected) {
this.expected = expected;
}
@Override
public boolean matches(Object o) {
if (!(o instanceof Event)) {
return false;
}
return expected == ((Event)o).getTimeMs();
}
@Override
public void describeTo(Description description) {
description.appendText(String.format("Event with time %d", expected));
}
@Override
public void describeMismatch(Object item, Description description) {
Event other = (Event)item;
description.appendText(String.format("event time is %d", other.getTimeMs()));
}
public static EventTimeIs eventTimeIs(long time) {
return new EventTimeIs(time);
}
}
|