| 1 |
/* |
| 2 |
* Copyright 2013 Emmanuel Bourg |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicab le law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package org.debian.maven.packager; |
| 18 |
|
| 19 |
import java.util.List; |
| 20 |
|
| 21 |
import junit.framework.TestCase; |
| 22 |
|
| 23 |
/** |
| 24 |
* @author Emmanuel Bourg |
| 25 |
* @version $Revision$, $Date$ |
| 26 |
*/ |
| 27 |
public class GenerateDebianFilesMojoTest extends TestCase { |
| 28 |
|
| 29 |
public void testFormatDescription() { |
| 30 |
GenerateDebianFilesMojo mojo = new GenerateDebianFilesMojo(); |
| 31 |
|
| 32 |
String description = "A framework for constructing recognizers, compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions."; |
| 33 |
|
| 34 |
List<String> lines = mojo.formatDescription(description); |
| 35 |
assertNotNull(lines); |
| 36 |
assertEquals("number of lines", 2, lines.size()); |
| 37 |
assertEquals("formatted description - line 1", "A framework for constructing recognizers, compilers, and translators from", lines.get(0)); |
| 38 |
assertEquals("formatted description - line 2", "grammatical descriptions containing Java, C#, C++, or Python actions.", lines.get(1)); |
| 39 |
} |
| 40 |
|
| 41 |
public void testFormatNullDescription() { |
| 42 |
GenerateDebianFilesMojo mojo = new GenerateDebianFilesMojo(); |
| 43 |
|
| 44 |
List<String> lines = mojo.formatDescription(null); |
| 45 |
assertNotNull(lines); |
| 46 |
assertEquals("number of lines", 0, lines.size()); |
| 47 |
} |
| 48 |
} |