1 package org.opendaylight.controller.config.yangjmxgenerator.plugin.util;
3 import org.junit.Ignore;
5 import org.opendaylight.controller.config.yangjmxgenerator.plugin.java.FullyQualifiedName;
7 import java.io.IOException;
9 import static java.util.Arrays.asList;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 public class StringUtilTest {
15 public void testPrefixAndJoin() {
16 assertEquals(" extends p1.Foo,Bar", StringUtil.prefixAndJoin(asList(
17 new FullyQualifiedName("p1", "Foo"), new FullyQualifiedName("", "Bar")), "extends"));
21 public void testAddAsterixAtEachLineStart() {
22 String input = "foo \nbar";
23 String expectedOutput = "* foo\n* bar\n";
24 assertEquals(expectedOutput, StringUtil.addAsterixAtEachLineStart(input));
29 public void testCopyright() throws IOException {
30 assertTrue(StringUtil.loadCopyright().isPresent());
34 public void testFormatting() {
36 String input = " \tpack;\n" +
42 String expected = "pack;\n" +
48 assertEquals(expected, StringUtil.formatJavaSource(input));
51 String input = "{\n" +
55 String expected = "{\n" +
59 assertEquals(expected, StringUtil.formatJavaSource(input));