Example usage for org.apache.commons.lang3 StringUtils LF

List of usage examples for org.apache.commons.lang3 StringUtils LF

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils LF.

Prototype

String LF

To view the source code for org.apache.commons.lang3 StringUtils LF.

Click Source Link

Document

A String for linefeed LF ("\n").

Usage

From source file:org.openecomp.sdc.ci.tests.execute.service.UpdateServiceMetadataTest.java

@Test
public void descriptionValidationTest8() throws Exception {
    updatedServiceDetails.setDescription("desc" + StringUtils.LF + "ription");
    RestResponse updateServiceResponse3 = ServiceRestUtils.updateService(updatedServiceDetails,
            sdncDesignerDetails);/*from   w  ww.  j a v  a  2  s .  co  m*/
    assertNotNull(updateServiceResponse3);
    assertNotNull(updateServiceResponse3.getErrorCode());
    assertEquals(200, updateServiceResponse3.getErrorCode().intValue());
    updatedServiceDetails.setDescription("desc ription");
    validateActualVsExpected(updatedServiceDetails, updateServiceResponse3);
    getServiceAndValidate(updatedServiceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
}

From source file:zhwb.study.compiler.CachedCompiler.java

public Map<String, byte[]> compileFromJava(String className, String javaCode) {
    Iterable<? extends JavaFileObject> compilationUnits;
    if (sourceDir != null) {
        String filename = className.replaceAll("\\.", '\\' + File.separator) + ".java";
        File file = new File(sourceDir, filename);
        writeText(file, javaCode);//ww  w .ja  v a  2s.c  om
        compilationUnits = CompilerUtils.s_standardJavaFileManager.getJavaFileObjects(file);

    } else {
        javaFileObjects.add(new JavaSourceFromString(className, javaCode));
        compilationUnits = javaFileObjects;
    }
    DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();

    // reuse the same file manager to allow caching of jar files
    Boolean status = CompilerUtils.s_compiler
            .getTask(null, CompilerUtils.s_fileManager, diagnostics, null, null, compilationUnits).call();
    if (!status) {//If compilation error occurs
        /*Iterate through each compilation problem and print it*/
        StringBuilder sb = new StringBuilder();
        sb.append(StringUtils.LF);
        for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
            sb.append(String.format("Error on line %d in %s", diagnostic.getLineNumber(), diagnostic))
                    .append(StringUtils.LF);
        }
        throw new IllegalStateException(String.format("compile error, %s", sb.toString()));
    }
    return CompilerUtils.s_fileManager.getAllBuffers();
}