/
CcpIdTest.java
52 lines (44 loc) · 1.42 KB
/
CcpIdTest.java
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2019 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.product.common;
import static com.opengamma.strata.collect.TestHelper.assertSerialization;
import static com.opengamma.strata.collect.TestHelper.coverPrivateConstructor;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import org.testng.annotations.Test;
/**
* Test {@link CcpId}.
*/
@Test
public class CcpIdTest {
public void test_of() {
CcpId test = CcpId.of("GB");
assertThat(test.getName()).isEqualTo("GB");
assertThat(test).hasToString("GB");
assertThatIllegalArgumentException().isThrownBy(() -> CcpId.of(""));
}
//-------------------------------------------------------------------------
public void test_equalsHashCode() {
CcpId a = CcpId.of("LCH");
CcpId a2 = CcpIds.LCH;
CcpId b = CcpId.of("CME");
assertThat(a)
.isEqualTo(a)
.isEqualTo(a2)
.isNotEqualTo(b)
.isNotEqualTo("")
.isNotEqualTo(null)
.hasSameHashCodeAs(a2);
}
//-------------------------------------------------------------------------
public void coverage() {
coverPrivateConstructor(CcpIds.class);
}
public void test_serialization() {
CcpId test = CcpId.of("LCH");
assertSerialization(test);
}
}