You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/12/12 14:13:27 UTC
[06/11] james-project git commit: JAMES-2249 JMAP cucmber test:
remove useless Exception declaration
JAMES-2249 JMAP cucmber test: remove useless Exception declaration
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/986458f8
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/986458f8
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/986458f8
Branch: refs/heads/master
Commit: 986458f8e9439c41ab0660831637593d0fcc445e
Parents: f48f0c2
Author: Luc DUZAN <ld...@linagora.com>
Authored: Mon Dec 11 14:11:16 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Dec 12 15:12:36 2017 +0100
----------------------------------------------------------------------
.../integration/cucumber/DownloadStepdefs.java | 17 +++---
.../cucumber/GetMailboxesMethodStepdefs.java | 2 +-
.../cucumber/GetMessageListMethodStepdefs.java | 8 +--
.../cucumber/GetMessagesMethodStepdefs.java | 58 ++++++++++----------
4 files changed, 42 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/986458f8/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index c98c130..79f793c 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -35,7 +35,6 @@ import javax.mail.Flags;
import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.fluent.Response;
import org.apache.http.client.utils.URIBuilder;
@@ -176,7 +175,7 @@ public class DownloadStepdefs {
downLoad(username, getMessagesMethodStepdefs.getBlobId());
}
- private void downLoad(String username, String blobId) throws IOException, ClientProtocolException, URISyntaxException {
+ private void downLoad(String username, String blobId) throws IOException, URISyntaxException {
URIBuilder uriBuilder = mainStepdefs.baseUri().setPath("/download/" + blobId);
response = authenticatedDownloadRequest(uriBuilder, blobId, username).execute().returnResponse();
}
@@ -359,12 +358,12 @@ public class DownloadStepdefs {
}
@When("^\"([^\"]*)\" delete mailbox \"([^\"]*)\"$")
- public void deleteMailboxButNotAttachment(String username, String mailboxName) throws Exception {
+ public void deleteMailboxButNotAttachment(String username, String mailboxName) {
mainStepdefs.mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, username, mailboxName);
}
@Then("^the user should be authorized$")
- public void httpStatusDifferentFromUnauthorized() throws IOException {
+ public void httpStatusDifferentFromUnauthorized() {
assertThat(response.getStatusLine().getStatusCode()).isIn(200, 404);
}
@@ -374,7 +373,7 @@ public class DownloadStepdefs {
}
@Then("^the user should not be authorized$")
- public void httpUnauthorizedStatus() throws IOException {
+ public void httpUnauthorizedStatus() {
assertThat(response.getStatusLine().getStatusCode()).isEqualTo(401);
}
@@ -384,7 +383,7 @@ public class DownloadStepdefs {
}
@Then("^the user should receive a bad request response$")
- public void httpBadRequestStatus() throws IOException {
+ public void httpBadRequestStatus() {
assertThat(response.getStatusLine().getStatusCode()).isEqualTo(400);
}
@@ -400,7 +399,7 @@ public class DownloadStepdefs {
}
@Then("^the user should receive a not found response$")
- public void httpNotFoundStatus() throws IOException {
+ public void httpNotFoundStatus() {
assertThat(response.getStatusLine().getStatusCode()).isEqualTo(404);
}
@@ -422,7 +421,7 @@ public class DownloadStepdefs {
}
@Then("^the attachment is named \"([^\"]*)\"$")
- public void assertContentDisposition(String name) throws IOException {
+ public void assertContentDisposition(String name) {
if (!CharMatcher.ASCII.matchesAllOf(name)) {
assertEncodedFilenameMatches(name);
} else {
@@ -431,7 +430,7 @@ public class DownloadStepdefs {
}
@Then("^the blob size is (\\d+)$")
- public void assertContentLength(int size) throws IOException {
+ public void assertContentLength(int size) {
assertThat(response.getFirstHeader("Content-Length").getValue()).isEqualTo(String.valueOf(size));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986458f8/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
index 3f94b85..93cb8ca 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMailboxesMethodStepdefs.java
@@ -59,7 +59,7 @@ public class GetMailboxesMethodStepdefs {
}
@Then("^a mailboxes answer is returned without error$")
- public void assertGetMailboxesOkStatus() throws Exception {
+ public void assertGetMailboxesOkStatus() {
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<String>read(NAME)).isEqualTo("mailboxes");
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986458f8/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
index 3e97ab1..cd72325 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessageListMethodStepdefs.java
@@ -136,20 +136,20 @@ public class GetMessageListMethodStepdefs {
}
@Then("^the message list is empty$")
- public void assertEmpty() throws Exception {
+ public void assertEmpty() {
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).isEmpty();
}
@Then("^the message list has size (\\d+)")
- public void assertSize(int size) throws Exception {
+ public void assertSize(int size) {
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).hasSize(size);
}
@Then("^the message list contains \"([^\"]*)\"")
- public void assertContains(String messsage) throws Exception {
- MessageId messageId = messageIdStepdefs.getMessageId(messsage);
+ public void assertContains(String message) {
+ MessageId messageId = messageIdStepdefs.getMessageId(message);
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".messageIds")).contains(messageId.serialize());
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986458f8/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index c31f010..b966720 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -500,14 +500,14 @@ public class GetMessagesMethodStepdefs {
}
@Then("^an error \"([^\"]*)\" is returned$")
- public void error(String type) throws Exception {
+ public void error(String type) {
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<String>read(NAME)).isEqualTo("error");
assertThat(httpClient.jsonPath.<String>read(ARGUMENTS + ".type")).isEqualTo(type);
}
@Then("^no error is returned$")
- public void noError() throws Exception {
+ public void noError() {
assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
assertThat(httpClient.jsonPath.<String>read(NAME)).isEqualTo("messages");
}
@@ -523,36 +523,36 @@ public class GetMessagesMethodStepdefs {
}
@Then("^the description is \"(.*?)\"$")
- public void assertDescription(String description) throws Exception {
+ public void assertDescription(String description) {
assertThat(httpClient.jsonPath.<String>read(ARGUMENTS + ".description")).isEqualTo(description);
}
@Then("^the notFound list should contain \"([^\"]*)\"$")
- public void assertNotFoundListContains(String id) throws Exception {
+ public void assertNotFoundListContains(String id) {
MessageId messageId = messageIdStepdefs.getMessageId(id);
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".notFound")).contains(messageId.serialize());
}
@Then("^the notFound list should contain the requested message id$")
- public void assertNotFoundListContainsRequestedMessages() throws Exception {
+ public void assertNotFoundListContainsRequestedMessages() {
ImmutableList<String> elements = requestedMessageIds.stream().map(MessageId::serialize).collect(Guavate.toImmutableList());
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".notFound")).containsExactlyElementsOf(elements);
}
@Then("^the list should contain (\\d+) message$")
- public void assertListContains(int numberOfMessages) throws Exception {
+ public void assertListContains(int numberOfMessages) {
assertThat(httpClient.jsonPath.<List<String>>read(ARGUMENTS + ".list")).hasSize(numberOfMessages);
}
@Then("^the id of the message is \"([^\"]*)\"$")
- public void assertIdOfTheFirstMessage(String messageName) throws Exception {
+ public void assertIdOfTheFirstMessage(String messageName) {
MessageId id = messageIdStepdefs.getMessageId(messageName);
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".id")).isEqualTo(id.serialize());
}
@Then("^the message is in \"([^\"]*)\" mailboxes")
- public void assertMailboxNamesOfTheFirstMessage(String mailboxNames) throws Exception {
+ public void assertMailboxNamesOfTheFirstMessage(String mailboxNames) {
List<String> values = Splitter.on(",")
.splitToList(mailboxNames).stream()
.map(Throwing.function(name -> mainStepdefs.jmapServer
@@ -585,45 +585,45 @@ public class GetMessagesMethodStepdefs {
}
@Then("^the threadId of the message is \"([^\"]*)\"$")
- public void assertThreadIdOfTheFirstMessage(String threadId) throws Exception {
+ public void assertThreadIdOfTheFirstMessage(String threadId) {
MessageId id = messageIdStepdefs.getMessageId(threadId);
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".threadId")).isEqualTo(id.serialize());
}
@Then("^the subject of the message is \"([^\"]*)\"$")
- public void assertSubjectOfTheFirstMessage(String subject) throws Exception {
+ public void assertSubjectOfTheFirstMessage(String subject) {
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".subject")).isEqualTo(subject);
}
@Then("^the textBody of the message is \"([^\"]*)\"$")
- public void assertTextBodyOfTheFirstMessage(String textBody) throws Exception {
+ public void assertTextBodyOfTheFirstMessage(String textBody) {
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".textBody")).isEqualTo(StringEscapeUtils.unescapeJava(textBody));
}
@Then("^the htmlBody of the message is \"([^\"]*)\"$")
- public void assertHtmlBodyOfTheFirstMessage(String htmlBody) throws Exception {
+ public void assertHtmlBodyOfTheFirstMessage(String htmlBody) {
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".htmlBody")).isEqualTo(StringEscapeUtils.unescapeJava(htmlBody));
}
@Then("^the isUnread of the message is \"([^\"]*)\"$")
- public void assertIsUnreadOfTheFirstMessage(String isUnread) throws Exception {
+ public void assertIsUnreadOfTheFirstMessage(String isUnread) {
assertThat(httpClient.jsonPath.<Boolean>read(FIRST_MESSAGE + ".isUnread")).isEqualTo(Boolean.valueOf(isUnread));
}
@Then("^the preview of the message is \"([^\"]*)\"$")
- public void assertPreviewOfTheFirstMessage(String preview) throws Exception {
+ public void assertPreviewOfTheFirstMessage(String preview) {
String actual = httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".preview").replace("\n", " ");
assertThat(actual).isEqualToIgnoringWhitespace(StringEscapeUtils.unescapeJava(preview));
}
@Then("^the preview of the message is not empty$")
- public void assertPreviewOfTheFirstMessageIsNotEmpty() throws Exception {
+ public void assertPreviewOfTheFirstMessageIsNotEmpty() {
String actual = httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".preview");
assertThat(actual).isNotEmpty();
}
@Then("^the preview should not contain consecutive spaces or blank characters$")
- public void assertPreviewShouldBeNormalized() throws Exception {
+ public void assertPreviewShouldBeNormalized() {
String actual = httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".preview");
assertThat(actual).hasSize(MessagePreviewGenerator.MAX_PREVIEW_LENGTH)
.doesNotMatch(" ")
@@ -632,69 +632,69 @@ public class GetMessagesMethodStepdefs {
}
@Then("^the headers of the message contains:$")
- public void assertHeadersOfTheFirstMessage(DataTable headers) throws Exception {
+ public void assertHeadersOfTheFirstMessage(DataTable headers) {
assertThat(httpClient.jsonPath.<Map<String, String>>read(FIRST_MESSAGE + ".headers")).containsAllEntriesOf(headers.asMap(String.class, String.class));
}
@Then("^the date of the message is \"([^\"]*)\"$")
- public void assertDateOfTheFirstMessage(String date) throws Exception {
+ public void assertDateOfTheFirstMessage(String date) {
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".date")).isEqualTo(date);
}
@Then("^the hasAttachment of the message is \"([^\"]*)\"$")
- public void assertHasAttachmentOfTheFirstMessage(String hasAttachment) throws Exception {
+ public void assertHasAttachmentOfTheFirstMessage(String hasAttachment) {
assertThat(httpClient.jsonPath.<Boolean>read(FIRST_MESSAGE + ".hasAttachment")).isEqualTo(Boolean.valueOf(hasAttachment));
}
@Then("^the isForwarded property of the message is \"([^\"]*)\"$")
- public void assertIsForwardedOfTheFirstMessage(String isForwarded) throws Exception {
+ public void assertIsForwardedOfTheFirstMessage(String isForwarded) {
assertThat(httpClient.jsonPath.<Boolean>read(FIRST_MESSAGE + ".isForwarded")).isEqualTo(Boolean.valueOf(isForwarded));
}
@Then("^the list of attachments of the message is empty$")
- public void assertAttachmentsOfTheFirstMessageIsEmpty() throws Exception {
+ public void assertAttachmentsOfTheFirstMessageIsEmpty() {
assertThat(httpClient.jsonPath.<List<Object>>read(ATTACHMENTS)).isEmpty();
}
@Then("^the property \"([^\"]*)\" of the message is null$")
- public void assertPropertyIsNull(String property) throws Exception {
+ public void assertPropertyIsNull(String property) {
assertThat(httpClient.jsonPath.<String>read(FIRST_MESSAGE + "." + property + ".date")).isNull();
}
@Then("^the list of attachments of the message contains (\\d+) attachments?$")
- public void assertAttachmentsHasSize(int numberOfAttachments) throws Exception {
+ public void assertAttachmentsHasSize(int numberOfAttachments) {
assertThat(httpClient.jsonPath.<List<Object>>read(ATTACHMENTS)).hasSize(numberOfAttachments);
}
@Then("^the list of attachments of the message contains only one attachment with cid \"([^\"]*)\"?$")
- public void assertAttachmentsAndItsCid(String cid) throws Exception {
+ public void assertAttachmentsAndItsCid(String cid) {
assertThat(httpClient.jsonPath.<String>read(FIRST_ATTACHMENT + ".cid")).isEqualTo(cid);
}
@Then("^the first attachment is:$")
- public void assertFirstAttachment(DataTable attachmentProperties) throws Exception {
+ public void assertFirstAttachment(DataTable attachmentProperties) {
assertAttachment(FIRST_ATTACHMENT, attachmentProperties);
}
@Then("^the second attachment is:$")
- public void assertSecondAttachment(DataTable attachmentProperties) throws Exception {
+ public void assertSecondAttachment(DataTable attachmentProperties) {
assertAttachment(SECOND_ATTACHMENT, attachmentProperties);
}
@Then("^the preview of the message contains: (.*)$")
- public void assertPreviewOfMessageShouldBePrintedWithEncoding(List<String> preview) throws Exception {
+ public void assertPreviewOfMessageShouldBePrintedWithEncoding(List<String> preview) {
String actual = httpClient.jsonPath.<String>read(FIRST_MESSAGE + ".preview");
assertThat(actual).contains(preview);
}
@Then("^the keywords of the message is (.*)$")
- public void assertKeywordsOfMessageShouldDisplay(List<String> keywords) throws Exception {
+ public void assertKeywordsOfMessageShouldDisplay(List<String> keywords) {
assertThat(httpClient.jsonPath.<Map<String, Boolean>>read(FIRST_MESSAGE + ".keywords").keySet())
.containsOnlyElementsOf(keywords);
}
@Then("^the message has no keyword$")
- public void assertMessageHasNoKeyword() throws Exception {
+ public void assertMessageHasNoKeyword() {
assertThat(httpClient.jsonPath.<Map<String, Boolean>>read(FIRST_MESSAGE + ".keywords"))
.isNullOrEmpty();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org