Skip to content

Commit

Permalink
Fixes #404 - test throwing exceptions
Browse files Browse the repository at this point in the history
* Bad data set for
  * Head
  * Submittor
  * Submittors
* Submittor not found
  • Loading branch information
dickschoeller committed Jun 14, 2017
1 parent 19a316c commit df43ad6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,15 @@ public final void testHeadControllerSchoeller() {
.contains("Destination:</span> GED55")
.contains("Character Set:</span> UTF-8");
}

/** */
@Test
public final void testHeadControllerBadDataSet() {
final ResponseEntity<String> entity = testRestTemplate.getForEntity(
"http://localhost:" + port + "/gedbrowser/head?db=XYZZY",
String.class);

then(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
then(entity.getBody()).contains("Data set not found");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,28 @@ public final void testSubmittorControllerU4() {
.contains("Address:</span> 50 East North Temple Street<br/>")
.contains("Salt Lake City, Utah 84150");
}

/** */
@Test
public final void testSubmittorControllerBadDataSet() {
final ResponseEntity<String> entity = testRestTemplate.getForEntity(
"http://localhost:" + port
+ "/gedbrowser/submittor?db=XYZZY&id=U4",
String.class);

then(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
then(entity.getBody()).contains("Data set not found");
}

/** */
@Test
public final void testSubmittorControllerBadSubmittor() {
final ResponseEntity<String> entity = testRestTemplate.getForEntity(
"http://localhost:" + port
+ "/gedbrowser/submittor?db=gl120368&id=U99999",
String.class);

then(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
then(entity.getBody()).contains("Submittor not found");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public final void testSubmttorsControllerOK() {
.contains("href=\"submittor?db=gl120368&amp;id=U11\">Lester LeMay")
.contains("href=\"submittor?db=gl120368&amp;id=U12\">David A. Blo")
.contains("href=\"submittor?db=gl120368&amp;id=U13\">Dave Morris");
}
}

/** */
@Test
public final void testSubmittorsControllerBadDataSet() {
final ResponseEntity<String> entity = testRestTemplate.getForEntity(
"http://localhost:" + port + "/gedbrowser/submittors?db=XYZZY",
String.class);

then(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
then(entity.getBody()).contains("Data set not found");
}
}

0 comments on commit df43ad6

Please sign in to comment.