1+ package com .imsweb .seerapi .client .mph ;
2+
3+ import java .io .IOException ;
4+
5+ import org .junit .BeforeClass ;
6+ import org .junit .Test ;
7+
8+ import com .imsweb .seerapi .client .BadRequestException ;
9+ import com .imsweb .seerapi .client .SeerApi ;
10+
11+ import static org .junit .Assert .assertEquals ;
12+
13+ public class MphTest {
14+
15+ private static MphService _MPH ;
16+
17+ @ BeforeClass
18+ public static void setup () {
19+ _MPH = new SeerApi .Builder ().connect ().mph ();
20+ }
21+
22+ @ Test (expected = BadRequestException .class )
23+ public void testMissingAllInput () throws IOException {
24+ _MPH .mph (new MphInputPair ()).execute ();
25+ }
26+
27+ @ Test (expected = BadRequestException .class )
28+ public void testMissingSite () throws IOException {
29+ MphInput input1 = new MphInput ();
30+ // site is missing
31+ input1 .setHistologyIcdO3 ("8000" );
32+ input1 .setBehaviorIcdO3 ("3" );
33+ input1 .setDateOfDiagnosisYear ("2016" );
34+ input1 .setLaterality ("1" );
35+
36+ MphInput input2 = new MphInput ();
37+ input2 .setPrimarySite ("C501" );
38+ input2 .setHistologyIcdO3 ("8000" );
39+ input2 .setBehaviorIcdO3 ("3" );
40+ input2 .setDateOfDiagnosisYear ("2016" );
41+ input2 .setLaterality ("1" );
42+
43+ _MPH .mph (new MphInputPair (input1 , input2 )).execute ();
44+ }
45+
46+ @ Test
47+ public void testResults () throws IOException {
48+ MphInput input1 = new MphInput ();
49+ input1 .setPrimarySite ("C509" );
50+ input1 .setHistologyIcdO3 ("8000" );
51+ input1 .setBehaviorIcdO3 ("3" );
52+ input1 .setDateOfDiagnosisYear ("2016" );
53+ input1 .setLaterality ("1" );
54+
55+ MphInput input2 = new MphInput ();
56+ input2 .setPrimarySite ("C501" );
57+ input2 .setHistologyIcdO3 ("8000" );
58+ input2 .setBehaviorIcdO3 ("3" );
59+ input2 .setDateOfDiagnosisYear ("2016" );
60+ input2 .setLaterality ("1" );
61+
62+ // first test single primary (only differs by site code)
63+ MphResult result = _MPH .mph (new MphInputPair (input1 , input2 )).execute ().body ();
64+ assertEquals (MphResult .Result .SINGLE_PRIMARY , result .getResult ());
65+
66+ // next test questionable (setting laterality to unknown for one of the diseases)
67+ input2 .setLaterality ("9" );
68+ result = _MPH .mph (new MphInputPair (input1 , input2 )).execute ().body ();
69+ assertEquals (MphResult .Result .QUESTIONABLE , result .getResult ());
70+
71+ // finally test difffernt diseases; set everything the same except for the DX year
72+ input1 .setPrimarySite ("C501" );
73+ input1 .setHistologyIcdO3 ("8000" );
74+ input1 .setBehaviorIcdO3 ("3" );
75+ input1 .setDateOfDiagnosisYear ("2016" );
76+ input1 .setLaterality ("1" );
77+ input2 .setPrimarySite ("C501" );
78+ input2 .setHistologyIcdO3 ("8000" );
79+ input2 .setBehaviorIcdO3 ("3" );
80+ input2 .setDateOfDiagnosisYear ("1998" );
81+ input2 .setLaterality ("1" );
82+ result = _MPH .mph (new MphInputPair (input1 , input2 )).execute ().body ();
83+ assertEquals (MphResult .Result .MULTIPLE_PRIMARIES , result .getResult ());
84+ }
85+
86+ }
0 commit comments