Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvard Fonsell committed Apr 18, 2020
1 parent 90872bd commit 6ff81b0
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import static java.util.Arrays.asList;
import static java.util.Collections.emptySet;
import static javax.ws.rs.core.Response.Status.CREATED;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.lenient;
Expand All @@ -25,7 +25,6 @@
import java.util.Optional;
import java.util.Set;

import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;

import org.joda.time.DateTime;
Expand Down Expand Up @@ -222,10 +221,12 @@ public void listWorkflowInstancesWorksWithAllIncludes() {
}

@Test
public void fetchingNonExistingWorkflowThrowsNotFoundException() {
when(workflowInstances.getWorkflowInstance(42, emptySet(), null))
.thenThrow(EmptyResultDataAccessException.class);
assertThrows(NotFoundException.class, () -> resource.fetchWorkflowInstance(42, null, null));
public void fetchingNonExistingWorkflowReturnsNotFound() {
when(workflowInstances.getWorkflowInstance(42, emptySet(), null)).thenThrow(EmptyResultDataAccessException.class);
try (Response response = resource.fetchWorkflowInstance(42, null, null)) {
assertThat(response.getStatus(), is(equalTo(NOT_FOUND.getStatusCode())));
assertThat(response.readEntity(String.class), is(equalTo("Workflow instance 42 not found")));
}
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 6ff81b0

Please sign in to comment.