Skip to content

Commit a2d0fc0

Browse files
authored
Merge branch 'develop' into QPPA-11206
2 parents ac3d8fb + 5482cfb commit a2d0fc0

13 files changed

Lines changed: 924 additions & 567 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package gov.cms.qpp.conversion.correlation.model;
2+
3+
import static com.google.common.truth.Truth.assertThat;
4+
import static org.junit.jupiter.api.Assertions.assertThrows;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
9+
import org.junit.jupiter.api.Test;
10+
11+
class CorrelationTest {
12+
13+
@Test
14+
void gettersAndSetters_work() {
15+
Correlation correlation = new Correlation();
16+
17+
correlation.setCorrelationId("corr-1");
18+
assertThat(correlation.getCorrelationId()).isEqualTo("corr-1");
19+
}
20+
21+
@Test
22+
void getConfig_returnsDefensiveCopy_changesToReturnedListDontAffectInternalState() {
23+
Correlation correlation = new Correlation();
24+
25+
List<CorrelationConfig> first = correlation.getConfig();
26+
assertThat(first).isEmpty();
27+
28+
first.add(new CorrelationConfig());
29+
30+
assertThat(correlation.getConfig()).isEmpty();
31+
}
32+
33+
@Test
34+
void setConfig_copiesInputList_laterMutationsToInputDontAffectInternalState() {
35+
Correlation correlation = new Correlation();
36+
37+
List<CorrelationConfig> input = new ArrayList<>();
38+
input.add(new CorrelationConfig());
39+
40+
correlation.setConfig(input);
41+
assertThat(correlation.getConfig()).hasSize(1);
42+
43+
input.add(new CorrelationConfig());
44+
45+
assertThat(correlation.getConfig()).hasSize(1);
46+
}
47+
48+
@Test
49+
void setConfig_null_throwsNpe() {
50+
Correlation correlation = new Correlation();
51+
52+
assertThrows(NullPointerException.class, () -> correlation.setConfig(null));
53+
}
54+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package gov.cms.qpp.conversion.correlation.model;
2+
3+
import static com.google.common.truth.Truth.assertThat;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
class GoodsTest {
8+
9+
@Test
10+
void gettersAndSetters_work() {
11+
Goods goods = new Goods();
12+
13+
goods.setRelativeXPath("/ClinicalDocument/id");
14+
goods.setXmltype("QRDA-III");
15+
16+
assertThat(goods.getRelativeXPath()).isEqualTo("/ClinicalDocument/id");
17+
assertThat(goods.getXmltype()).isEqualTo("QRDA-III");
18+
}
19+
20+
@Test
21+
void allowsNulls() {
22+
Goods goods = new Goods();
23+
24+
goods.setRelativeXPath(null);
25+
goods.setXmltype(null);
26+
27+
assertThat(goods.getRelativeXPath()).isNull();
28+
assertThat(goods.getXmltype()).isNull();
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package gov.cms.qpp.conversion.correlation.model;
2+
3+
import static com.google.common.truth.Truth.assertThat;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
class TemplateTest {
8+
9+
@Test
10+
void gettersAndSetters_work() {
11+
Template template = new Template();
12+
13+
template.setTemplateId("2.16.840.1.113883.10.20.27.3.1");
14+
template.setCorrelationId("corr-123");
15+
16+
assertThat(template.getTemplateId()).isEqualTo("2.16.840.1.113883.10.20.27.3.1");
17+
assertThat(template.getCorrelationId()).isEqualTo("corr-123");
18+
}
19+
20+
@Test
21+
void allowsNulls() {
22+
Template template = new Template();
23+
24+
template.setTemplateId(null);
25+
template.setCorrelationId(null);
26+
27+
assertThat(template.getTemplateId()).isNull();
28+
assertThat(template.getCorrelationId()).isNull();
29+
}
30+
}
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
package gov.cms.qpp.conversion.api;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.Assert.assertNotNull;
44

5-
@SpringTest
6-
class RestApiApplicationTest {
5+
import org.junit.Test;
76

8-
// @Test
9-
// void contextLoads() {
10-
// }
11-
//
12-
// @Test
13-
// void testMain() {
14-
// RestApiApplication.main();
15-
//
16-
//
17-
// }
7+
public class RestApiApplicationTest {
188

9+
@Test
10+
public void mainMethodExists() throws Exception {
11+
assertNotNull(RestApiApplication.class.getMethod("main", String[].class));
12+
}
1913
}

0 commit comments

Comments
 (0)