Example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR

List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Prototype

String LINE_SEPARATOR

To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.

Click Source Link

Document

The line.separator System Property.

Usage

From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java

/**
 * Test for param 2// ww  w. j a v  a2  s .  c  o  m
 */
@Test
public void testCreateMethodLineForStringParam2() {
    MethodBuilder builder = new MethodBuilder();
    String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", "test", 2);
    System.out.println(result);

    String expected = "public java.lang.String createParam2String_org_test_DummyClass_dummyMethod() {"
            + SystemUtils.LINE_SEPARATOR;
    assertEquals(expected, result);
}

From source file:com.alibaba.otter.shared.common.utils.cmd.StreamCopier.java

public void run() {
    try {/*  w ww .j  a va  2 s .c o m*/
        StringBuffer buf = new StringBuffer();
        String line = null;

        while ((line = reader.readLine()) != null) {
            if (identifier != null) {
                line = identifier + line;
            }

            if (false == StringUtils.isBlank(line)) {
                buf.append(line).append(SystemUtils.LINE_SEPARATOR);
            }
        }

        out.write(buf.toString().getBytes());
        out.flush();
    } catch (IOException ioe) {
        //ignore
    } finally {
        IOUtils.closeQuietly(reader);
    }
}

From source file:com.google.api.ads.adwords.keywordoptimizer.KeywordInfo.java

@Override
public String toString() {
    StringBuilder out = new StringBuilder();

    out.append(KeywordOptimizerUtil.toString(keyword));
    if (hasScore()) {
        out.append(": ").append(KeywordOptimizerUtil.format(score));
    }/*from w ww  .j a  va2  s  .c  o m*/
    out.append(SystemUtils.LINE_SEPARATOR);
    if (hasEstimate()) {
        out.append(estimate);
    }

    return out.toString();
}

From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java

/**
 * Test for return value instead of param
 *///from  w  ww . jav  a 2 s  .co  m
@Test
public void testCreateMethodLineForStringReturn() {
    MethodBuilder builder = new MethodBuilder();
    String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", "test", 0);
    System.out.println(result);

    String expected = "public java.lang.String createReturnString_org_test_DummyClass_dummyMethod() {"
            + SystemUtils.LINE_SEPARATOR;
    assertEquals(expected, result);
}

From source file:de.openknowledge.cdi.monitoring.HealthStatusQueryCommand.java

private void appendAll(StringBuffer aBuffer, Set<ComponentStatus> aComponentStatuses) {
    for (ComponentStatus status : aComponentStatuses) {
        aBuffer.append(status);/*from   w  w w.ja  v a  2s  . co  m*/
        aBuffer.append(SystemUtils.LINE_SEPARATOR);
    }
}

From source file:au.com.dw.testdatacapturej.reflection.TestGenNullTest.java

/**
 * Test for null Object field./*from   w  ww  .j  a v a  2s. c  om*/
 */
@Test
public void nullObjectTest() {
    try {
        logger.logObject(builder, handler.handle(new NullObjectHolder()));
        String result = builder.getLog();

        String expected = SystemUtils.LINE_SEPARATOR
                + "au.com.dw.testdatacapturej.mock.dataholder.NullObjectHolder nullObjectHolder0 = new au.com.dw.testdatacapturej.mock.dataholder.NullObjectHolder();"
                + SystemUtils.LINE_SEPARATOR + "nullObjectHolder0.setNullField(null);"
                + SystemUtils.LINE_SEPARATOR;

        System.out.println(result);
        assertEquals(expected, result);
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
}

From source file:com.shigengyu.common.ListHashMap.java

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    int count = 0;
    for (Entry<K, List<V>> entry : map.entrySet()) {
        sb.append(entry.getKey() + " (" + entry.getKey().hashCode() + ") = " + entry.getValue()
                + SystemUtils.LINE_SEPARATOR);
        ++count;// ww w  . j a v  a  2s. c  om

        if (count == 10) {
            sb.append("...");
            return sb.toString();
        }
    }
    return sb.toString();
}

From source file:au.org.ala.delta.translation.TypeSetterTest.java

public void testLineWrap() {
    String input = "The quick brown fox jumps over the lazy dog....";
    _typeSetter.writeJustifiedText(input, -1);
    _typeSetter.printBufferLine(false);//from   w  ww  . ja va 2 s  .  com

    assertEquals(input + SystemUtils.LINE_SEPARATOR, output());

    _typeSetter.setIndent(4);
    _typeSetter.indent();
    _typeSetter.writeJustifiedText(input, -1);
    _typeSetter.printBufferLine(false);

    assertEquals("    " + input + SystemUtils.LINE_SEPARATOR, output());

    input = input + input;
    _typeSetter.setIndent(4);
    _typeSetter.indent();
    _typeSetter.writeJustifiedText(input, -1);
    _typeSetter.printBufferLine(false);

    String[] lines = output().split(SystemUtils.LINE_SEPARATOR);

    assertEquals("    The quick brown fox jumps over the lazy dog....The quick brown fox jumps", lines[0]);
    assertEquals("over the lazy dog....", lines[1]);

    input = "Thisisareallyreallyreallyreallyreallyreallyreallyreallylongstringreallyreallyreally";
    _typeSetter.setIndent(4);
    _typeSetter.indent();
    _typeSetter.writeJustifiedText(input, -1);
    _typeSetter.printBufferLine(false);

    lines = output().split(SystemUtils.LINE_SEPARATOR);

    assertEquals("    " + input.substring(0, 76), lines[0]);
    assertEquals(input.substring(76, input.length()), lines[1]);

}

From source file:com.google.api.ads.adwords.keywordoptimizer.TrafficEstimate.java

@Override
public String toString() {
    StringBuilder out = new StringBuilder();

    out.append("- Min:  ").append(KeywordOptimizerUtil.toString(min)).append(SystemUtils.LINE_SEPARATOR);
    out.append("- Mean: ").append(KeywordOptimizerUtil.toString(mean)).append(SystemUtils.LINE_SEPARATOR);
    out.append("- Max:  ").append(KeywordOptimizerUtil.toString(max));

    return out.toString();
}

From source file:au.com.dw.testdatacapturej.builder.MethodBuilderTest.java

/**
 * Test for primitive value instead of object as param
 *//*from  w w w . java  2s  . c  o m*/
@Test
public void testCreateMethodLineForIntParam1() {
    MethodBuilder builder = new MethodBuilder();
    String result = builder.createMethodLine("org.test.DummyClass.dummyMethod", 100, 1);
    System.out.println(result);

    String expected = "public java.lang.Integer createParam1Integer_org_test_DummyClass_dummyMethod() {"
            + SystemUtils.LINE_SEPARATOR;
    assertEquals(expected, result);
}