Cleaned up whitespace, fix DOS line endings
[nbgit.git] / test / unit / src / org / nbgit / ui / commit / StripSpaceTest.java
blob4d2101271c2d6a94d9e9e30590671882344e8b76
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 2008 Jonas Fonseca <fonseca@diku.dk>
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common
8 * Development and Distribution License("CDDL") (collectively, the
9 * "License"). You may not use this file except in compliance with the
10 * License. You can obtain a copy of the License at
11 * http://www.netbeans.org/cddl-gplv2.html. See the License for the
12 * specific language governing permissions and limitations under the
13 * License. When distributing the software, include this License Header
14 * Notice in each file.
16 * This particular file is subject to the "Classpath" exception as provided
17 * by Sun in the GPL Version 2 section of the License file that
18 * accompanied this code. If applicable, add the following below the
19 * License Header, with the fields enclosed by brackets [] replaced by
20 * your own identifying information:
21 * "Portions Copyrighted [year] [name of copyright owner]"
23 * Contributor(s):
25 * If you wish your version of this file to be governed by only the CDDL
26 * or only the GPL Version 2, indicate your decision by adding
27 * "[Contributor] elects to include this software in this distribution
28 * under the [CDDL or GPL Version 2] license." If you do not indicate a
29 * single choice of license, a recipient has the option to distribute
30 * your version of this file under either the CDDL, the GPL Version 2 or
31 * to extend the choice of license to its licensees as provided above.
32 * However, if you add GPL Version 2 code and therefore, elected the GPL
33 * Version 2 license, then the option applies only if the new code is
34 * made subject to such option by the copyright holder.
36 package org.nbgit.ui.commit;
38 import org.junit.Test;
39 import static org.junit.Assert.*;
41 public class StripSpaceTest {
43 @Test
44 public void endOfLine() {
45 assertEquals("abc\n", CommitAction.stripSpace("abc \t \r\n"));
46 assertEquals("a\nbc\n", CommitAction.stripSpace("a \nbc \t \n"));
49 @Test
50 public void emptyLines() {
51 assertEquals("abc\n", CommitAction.stripSpace("\n\n\nabc \t \n"));
52 assertEquals("a\nbc\n", CommitAction.stripSpace("a \nbc \t \n\n\n\n\n"));
53 assertEquals("", CommitAction.stripSpace(" \t \n \n\n\n\n"));
56 @Test
57 public void consecutiveEmptyLines() {
58 assertEquals("a\n\nb\nc\n", CommitAction.stripSpace("\n\n\na\n\n\n\nb\nc \t \n"));
59 assertEquals("a\n\nbc\n", CommitAction.stripSpace("a \n\n\n\n\nbc \t \n\n\n\n\n"));