Skip to content

Commit 9efe2c1

Browse files
committed
Fixed error response and cleaned up failing tests
1 parent 98c3ca0 commit 9efe2c1

7 files changed

Lines changed: 50 additions & 36 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ findbugs {
6565

6666
// Gradle wrapper, this allows to build the project without having to install Gradle!
6767
task wrapper(type: Wrapper) {
68-
gradleVersion = '4.0'
68+
gradleVersion = '4.1'
6969
}
7070

7171
modifyPom {

gradle/wrapper/gradle-wrapper.jar

2 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 16 16:42:51 EDT 2017
1+
#Fri Aug 18 11:34:44 EDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

src/main/java/com/imsweb/seerapi/client/ErrorResponse.java

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,54 @@
44

55
public class ErrorResponse {
66

7-
@JsonProperty("code")
8-
protected Integer _id;
7+
@JsonProperty("timestamp")
8+
private String _timestamp;
9+
@JsonProperty("status")
10+
private Integer _status;
11+
@JsonProperty("error")
12+
private String _error;
913
@JsonProperty("message")
10-
protected String _message;
14+
private String _message;
15+
@JsonProperty("path")
16+
private String _path;
1117

12-
/**
13-
* Default constructor
14-
*/
15-
public ErrorResponse() {
18+
public String getTimestamp() {
19+
return _timestamp;
1620
}
1721

18-
/**
19-
* Return the error identifier
20-
* @return an error identifier
21-
*/
22-
public Integer getId() {
23-
return _id;
22+
public void setTimestamp(String timestamp) {
23+
_timestamp = timestamp;
24+
}
25+
26+
public Integer getStatus() {
27+
return _status;
28+
}
29+
30+
public void setStatus(Integer status) {
31+
_status = status;
32+
}
33+
34+
public String getError() {
35+
return _error;
36+
}
37+
38+
public void setError(String error) {
39+
_error = error;
2440
}
2541

26-
/**
27-
* Return the error message
28-
* @return an error message
29-
*/
3042
public String getMessage() {
3143
return _message;
3244
}
45+
46+
public void setMessage(String message) {
47+
_message = message;
48+
}
49+
50+
public String getPath() {
51+
return _path;
52+
}
53+
54+
public void setPath(String path) {
55+
_path = path;
56+
}
3357
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void testMissingAllInput() throws IOException {
2626
_MPH.mph(new MphInputPair()).execute();
2727
}
2828

29-
@Test
29+
@Test(expected = BadRequestException.class)
3030
public void testMissingSite() throws IOException {
3131
MphInput input1 = new MphInput();
3232
// site is missing
@@ -43,10 +43,6 @@ public void testMissingSite() throws IOException {
4343
input2.setLaterality("1");
4444

4545
MphOutput result = _MPH.mph(new MphInputPair(input1, input2)).execute().body();
46-
assertEquals(MphOutput.Result.QUESTIONABLE, result.getResult());
47-
assertEquals(
48-
"Unable to identify cancer group for first set of parameters. Valid primary site (C000-C999 excluding C809), histology (8000-9999), behavior (0-3, 6) and diagnosis year are required.",
49-
result.getReason());
5046
}
5147

5248
@Test

src/test/java/com/imsweb/seerapi/client/ndc/NdcTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ public void testNdcByCode() throws IOException {
5656

5757
assertEquals(Arrays.asList("Norepinephrine Reuptake Inhibitor [EPC]", "Norepinephrine Uptake Inhibitors [MoA]"), product.getPharmClass());
5858

59-
assertEquals(2, product.getPackages().size());
60-
assertEquals("07", product.getPackages().get(0).getCode());
61-
assertEquals("7 CAPSULE in 1 BOTTLE (0002-3227-07)", product.getPackages().get(0).getDescription());
62-
assertEquals("30", product.getPackages().get(1).getCode());
63-
assertEquals("30 CAPSULE in 1 BOTTLE (0002-3227-30)", product.getPackages().get(1).getDescription());
59+
assertEquals(1, product.getPackages().size());
60+
assertEquals("30", product.getPackages().get(0).getCode());
61+
assertEquals("30 CAPSULE in 1 BOTTLE (0002-3227-30)", product.getPackages().get(0).getDescription());
6462

6563
assertNotNull(product.getDateAdded());
6664
assertNotNull(product.getDateModified());
@@ -78,8 +76,6 @@ public void testNdcSearch() throws IOException {
7876
Integer totalIncludingRemoved = Integer.valueOf(response.headers().get("X-Total-Count"));
7977
assertTrue(totalIncludingRemoved > 100000);
8078

81-
assertEquals(3, response.headers().values("Link").size());
82-
8379
List<NdcProduct> products = response.body();
8480
assertEquals(25, products.size());
8581

src/test/java/com/imsweb/seerapi/client/siterecode/SiteRecodeTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static void setup() {
2828
}
2929

3030
@Test(expected = BadRequestException.class)
31-
public void testBadRequestExceptiion() throws IOException {
31+
public void testBadRequestException() throws IOException {
3232
_SITE_RECODE.siteGroup("C379", null).execute();
3333
}
3434

@@ -45,9 +45,7 @@ public void testExceptionMessages() throws IOException {
4545

4646
// the API call works out to:
4747
// https://api.seer.cancer.gov/rest/recode/sitegroup?site=C379
48-
// and the full message returned should be
49-
// {"code":400,"message":"Site and histology must be supplied"}
50-
assertEquals("Site and histology must be supplied", message);
48+
assertEquals("Required String parameter 'hist' is not present", message);
5149
}
5250

5351
@Test

0 commit comments

Comments
 (0)