Skip to content

Commit 98c3ca0

Browse files
committed
MPH supports additional validation and throws a 400 error
1 parent eb5f5b2 commit 98c3ca0

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

src/main/java/com/imsweb/seerapi/client/mph/MphOutput.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@
66

77
public class MphOutput {
88

9-
// The possible results of determining if two tumors are single or multiple primaries.
10-
public enum Result {
11-
// indicates the two tumors are the same primary
12-
SINGLE_PRIMARY,
13-
// indicates the two tumors are different primaries
14-
MULTIPLE_PRIMARIES,
15-
// indicates there is not enough information to make a proper determination
16-
QUESTIONABLE
17-
}
18-
199
@JsonProperty("result")
2010
private Result _result;
2111
@JsonProperty("reason")
@@ -26,7 +16,6 @@ public enum Result {
2616
private String _groupId;
2717
@JsonProperty("step")
2818
private String _step;
29-
3019
public MphOutput() {
3120
}
3221

@@ -69,4 +58,14 @@ public String getStep() {
6958
public void setStep(String step) {
7059
_step = step;
7160
}
61+
62+
// The possible results of determining if two tumors are single or multiple primaries.
63+
public enum Result {
64+
// indicates the two tumors are the same primary
65+
SINGLE_PRIMARY,
66+
// indicates the two tumors are different primaries
67+
MULTIPLE_PRIMARIES,
68+
// indicates there is not enough information to make a proper determination
69+
QUESTIONABLE
70+
}
7271
}

src/test/java/com/imsweb/seerapi/client/mph/MphTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,21 @@ public void testLenientMode() throws IOException {
143143
assertEquals("M13", result.getStep());
144144
}
145145

146+
@Test(expected = BadRequestException.class)
147+
public void testInvalidInput() throws IOException {
148+
MphInput i1 = new MphInput();
149+
MphInput i2 = new MphInput();
150+
151+
// invalid primary site
152+
i1.setPrimarySite("C080");
153+
i2.setPrimarySite("D080");
154+
i1.setHistologyIcdO3("8000");
155+
i1.setBehaviorIcdO3("3");
156+
i2.setHistologyIcdO3("8100");
157+
i2.setBehaviorIcdO3("3");
158+
i1.setDateOfDiagnosisYear("2015");
159+
i2.setDateOfDiagnosisYear("2015");
160+
_MPH.mph(new MphInputPair(i1, i2)).execute().body();
161+
}
162+
146163
}

0 commit comments

Comments
 (0)