Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Georgi2015-04-19 12:04:32 +0000
committerChristian Georgi2015-04-20 10:40:02 +0000
commitd24cdb3eb01e316a62776ba3a57c88d7a3ef40a6 (patch)
tree234a19624438e1c2cc1d262e2b5de1f553c47c47 /org.eclipse.egit.ui.test
parentfa231643f59af11b03d2072e3ba32c29edfeca0f (diff)
downloadegit-d24cdb3eb01e316a62776ba3a57c88d7a3ef40a6.tar.gz
egit-d24cdb3eb01e316a62776ba3a57c88d7a3ef40a6.tar.xz
egit-d24cdb3eb01e316a62776ba3a57c88d7a3ef40a6.zip
Check for empty second line in commit message
Staging view and commit dialog now show a warning 'Second line should be empty'. Also add test for this new check. Bug: 464952 Change-Id: I04a9320601d24bf3c8825bf57c967496d94a8acc Signed-off-by: Christian Georgi <christian.georgi@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentTest.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentTest.java
new file mode 100644
index 0000000000..2537f22068
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageComponentTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (C) 2015 SAP SE (Christian Georgi <christian.georgi@sap.com>)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.dialogs;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.egit.ui.internal.UIText;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.junit.Test;
+
+public class CommitMessageComponentTest {
+
+ @Test
+ public void commitFormat_simple() {
+ IDocument document = new Document("Simple message");
+
+ String message = CommitMessageComponent
+ .formatIssuesInCommitMessage(document);
+ assertEquals(null, message);
+ }
+
+ @Test
+ public void commitFormat_trailingWhitespace_ok() {
+ IDocument document = new Document("Simple message\n\n\n");
+
+ String message = CommitMessageComponent
+ .formatIssuesInCommitMessage(document);
+ assertEquals(null, message);
+ }
+
+ @Test
+ public void commitFormat_MultipleLines_ok() {
+ IDocument document = new Document("Summary\n\nDetails");
+
+ String message = CommitMessageComponent
+ .formatIssuesInCommitMessage(document);
+ assertEquals(null, message);
+ }
+
+ @Test
+ public void commitFormat_MultipleLines_notOk() {
+ IDocument document = new Document("Summary\nDetails");
+
+ String message = CommitMessageComponent
+ .formatIssuesInCommitMessage(document);
+ assertEquals(UIText.CommitMessageComponent_MessageSecondLineNotEmpty,
+ message);
+ }
+
+ @Test
+ public void commitFormat_MultipleLines_notOk2() {
+ IDocument document = new Document("Summary\n \nDetails");
+
+ String message = CommitMessageComponent
+ .formatIssuesInCommitMessage(document);
+ assertEquals(UIText.CommitMessageComponent_MessageSecondLineNotEmpty,
+ message);
+ }
+
+}

Back to the top