home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (PlatformLineWriterTest.java)

This example Groovy source code file (PlatformLineWriterTest.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

adams, adams, hashmap, io, ioexception, ls, ls, map, string, stringwriter, stringwriter, testcase, tom, tom, util, writer

The Groovy PlatformLineWriterTest.java source code

package groovy.io;

import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import junit.framework.TestCase;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

public class PlatformLineWriterTest extends TestCase {

    public void testPlatformLineWriter() throws IOException, ClassNotFoundException {
        String LS = System.getProperty("line.separator");
        Map binding = new HashMap();
        binding.put("first", "Tom");
        binding.put("last", "Adams");
        Template template = new SimpleTemplateEngine().createTemplate("<%= first %>\n<% println last %>");
        StringWriter stringWriter = new StringWriter();
        Writer platformWriter = new PlatformLineWriter(stringWriter);
        assertEquals("Tom" + LS + "Adams" + LS, stringWriter.toString());

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy PlatformLineWriterTest.java source code file:

new blog posts


Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.