1
2
3
4
5 package com.jcabi.github;
6
7 import org.hamcrest.MatcherAssert;
8 import org.hamcrest.Matchers;
9 import org.junit.jupiter.api.Test;
10 import org.mockito.Mockito;
11
12
13
14
15
16
17 final class LabelTest {
18
19 @Test
20 void canBeComparedProperly() {
21 final Label.Unmodified one = new Label.Unmodified(
22 LabelTest.repo("jef", "jef_repo"),
23 "{\"name\":\"paul\"}"
24 );
25 final Label.Unmodified other = new Label.Unmodified(
26 LabelTest.repo("stan", "stan_repo"),
27 "{\"name\":\"paul\"}"
28 );
29 MatcherAssert.assertThat(
30 "Values are not equal",
31 one.equals(other),
32 Matchers.is(false)
33 );
34 MatcherAssert.assertThat(
35 "Assertion failed",
36 one.compareTo(other),
37 Matchers.not(0)
38 );
39 }
40
41
42
43
44
45
46
47 private static Repo repo(final String user, final String rpo) {
48 final Repo repo = Mockito.mock(Repo.class);
49 Mockito.doReturn(new Coordinates.Simple(user, rpo))
50 .when(repo).coordinates();
51 return repo;
52 }
53 }