JSIEVE-108 Discard instruction should emmit a ActionDiscard
diff --git a/core/src/main/java/org/apache/jsieve/commands/Discard.java b/core/src/main/java/org/apache/jsieve/commands/Discard.java
index e55cf9b..2696fb7 100644
--- a/core/src/main/java/org/apache/jsieve/commands/Discard.java
+++ b/core/src/main/java/org/apache/jsieve/commands/Discard.java
@@ -23,6 +23,7 @@
 import org.apache.jsieve.Block;
 import org.apache.jsieve.SieveContext;
 import org.apache.jsieve.exception.SieveException;
+import org.apache.jsieve.mail.ActionDiscard;
 import org.apache.jsieve.mail.MailAdapter;
 
 /**
@@ -54,6 +55,9 @@
         // Just cancels the implicit keep
         // See http://tools.ietf.org/html/rfc5228#section-4.4
         context.getCommandStateManager().setImplicitKeep(false);
+
+        mail.addAction(new ActionDiscard());
+
         return null;
     }
 
diff --git a/core/src/main/java/org/apache/jsieve/mail/ActionDiscard.java b/core/src/main/java/org/apache/jsieve/mail/ActionDiscard.java
new file mode 100644
index 0000000..1d4e191
--- /dev/null
+++ b/core/src/main/java/org/apache/jsieve/mail/ActionDiscard.java
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.jsieve.mail;
+
+/**
+ * Class ActionDiscard encapsulates the information required to discard a mail. See
+ * RFC 3028, Section 4.4.
+ */
+public class ActionDiscard implements Action {
+
+}
diff --git a/core/src/test/java/org/apache/jsieve/DiscardTest.java b/core/src/test/java/org/apache/jsieve/DiscardTest.java
index 0cf8e0c..580cd09 100644
--- a/core/src/test/java/org/apache/jsieve/DiscardTest.java
+++ b/core/src/test/java/org/apache/jsieve/DiscardTest.java
@@ -19,72 +19,49 @@
 
 package org.apache.jsieve;
 
-import org.apache.jsieve.exception.SieveException;
+import static org.assertj.core.api.Assertions.assertThat;
+
 import org.apache.jsieve.exception.SyntaxException;
+import org.apache.jsieve.mail.Action;
+import org.apache.jsieve.mail.ActionDiscard;
 import org.apache.jsieve.mail.MailAdapter;
-import org.apache.jsieve.parser.generated.ParseException;
 import org.apache.jsieve.utils.JUnitUtils;
-import org.junit.Assert;
+import org.assertj.core.api.Condition;
 import org.junit.Test;
 
-/**
- * Class DiscardTest
- */
 public class DiscardTest {
 
-    /**
-     * Test for Command 'discard' with invalid arguments
-     */
-    @org.junit.Test
-    public void testInvalidArguments() {
-        boolean isTestPassed = false;
+    private static final Condition<Action> INSTANCE_OF_ACTION_DISCARDED = new Condition<Action>() {
+        @Override
+        public boolean matches(Action action) {
+            return action instanceof ActionDiscard;
+        }
+    };
+
+    @Test(expected = SyntaxException.class)
+    public void discardShouldThrowOnInvalidArguments() throws Exception {
         String script = "discard 1 ;";
 
-        try {
-            JUnitUtils.interpret(JUnitUtils.createMail(), script);
-        } catch (SyntaxException e) {
-            isTestPassed = true;
-        } catch (ParseException e) {
-        } catch (SieveException e) {
-        }
-        Assert.assertTrue(isTestPassed);
+        JUnitUtils.interpret(JUnitUtils.createMail(), script);
     }
 
-    /**
-     * Test for Command 'discard' with an invalid block
-     */
-    @Test
-    public void testInvalidBlock() {
-        boolean isTestPassed = false;
-        String script = "discard 1 {throwTestException;}";
+    @Test(expected = SyntaxException.class)
+    public void discardShouldThrowOnInvalidFollowingBlock() throws Exception {
+        String script = "discard {throwTestException;}";
 
-        try {
-            JUnitUtils.interpret(JUnitUtils.createMail(), script);
-        } catch (SyntaxException e) {
-            isTestPassed = true;
-        } catch (ParseException e) {
-        } catch (SieveException e) {
-        }
-        Assert.assertTrue(isTestPassed);
+        JUnitUtils.interpret(JUnitUtils.createMail(), script);
     }
 
-    /*
-     * Test for Command 'discard'
-     */
     @Test
-    public void testDiscard() {
-        boolean isTestPassed = false;
+    public void discardShouldAddOnlyActionDiscard() throws Exception {
         String script = "discard;";
 
-        try {
-            MailAdapter mail = JUnitUtils.createMail();
-            JUnitUtils.interpret(mail, script);
-            Assert.assertTrue(mail.getActions().isEmpty());
-            isTestPassed = true;
-        } catch (ParseException e) {
-        } catch (SieveException e) {
-        }
-        Assert.assertTrue(isTestPassed);
+        MailAdapter mail = JUnitUtils.createMail();
+        JUnitUtils.interpret(mail, script);
+
+        assertThat(mail.getActions())
+            .hasSize(1)
+            .are(INSTANCE_OF_ACTION_DISCARDED);
     }
 
 }