package org.codehaus.plexus.util;

import junit.framework.TestCase;

import java.util.Map;
import java.util.HashMap;
import java.io.StringReader;
import java.io.StringWriter;

import org.codehaus.plexus.context.DefaultContext;

/**
 * Generated by JUnitDoclet, a tool provided by ObjectFab GmbH under LGPL.
 * Please see www.junitdoclet.org, www.gnu.org and www.objectfab.de for
 * informations about the tool, the licence and the authors.
 */
public class ContextMapAdapterTest
    extends TestCase
{
    public ContextMapAdapterTest( String name )
    {
        super( name );
    }

    public void testInterpolation()
        throws Exception
    {
        DefaultContext context = new DefaultContext();

        context.put( "name", "jason" );

        context.put( "occupation", "exotic dancer" );

        ContextMapAdapter adapter = new ContextMapAdapter( context );

        assertEquals( "jason", (String) adapter.get( "name" ) );

        assertEquals( "exotic dancer", (String) adapter.get( "occupation" ) );

        assertNull( adapter.get( "foo") );
    }
}

@@ -32,90 +32,8 @@
 l;%0A%0A
-import junit.framework.TestCase;%0A%0Aimport java.util.Map;%0Aimport java.util.HashMap;%0A
 impo
@@ -87,16 +87,50 @@
 riter;%0A%0A
+import junit.framework.TestCase;%0A%0A
 import o
@@ -1015,11 +1015,653 @@
 );%0A    %7D
+%0A%0A    public void testInterpolationWithContext()%0A        throws Exception%0A    %7B%0A        DefaultContext context = new DefaultContext();%0A        context.put( %22name%22, %22jason%22 );%0A        context.put( %22noun%22, %22asshole%22 );%0A%0A        String foo = %22$%7Bname%7D is an $%7Bnoun%7D. $%7Bnot.interpolated%7D%22;%0A%0A        InterpolationFilterReader reader =%0A            new InterpolationFilterReader( new StringReader( foo ), new ContextMapAdapter( context ) );%0A%0A        StringWriter writer = new StringWriter();%0A        IOUtil.copy( reader, writer );%0A%0A        String bar = writer.toString();%0A        assertEquals( %22jason is an asshole. $%7Bnot.interpolated%7D%22, bar );%0A    %7D
 %0A%7D%0A

Add test from InterpolationFilterReaderTest, removing circular dependency.