001package org.apache.maven.scm.provider.jazz.command.consumer;
002
003import junit.framework.TestCase;
004import org.apache.maven.scm.log.DefaultLog;
005
006/*
007 * Licensed to the Apache Software Foundation (ASF) under one
008 * or more contributor license agreements.  See the NOTICE file
009 * distributed with this work for additional information
010 * regarding copyright ownership.  The ASF licenses this file
011 * to you under the Apache License, Version 2.0 (the
012 * "License"); you may not use this file except in compliance
013 * with the License.  You may obtain a copy of the License at
014 *
015 * http://www.apache.org/licenses/LICENSE-2.0
016 *
017 * Unless required by applicable law or agreed to in writing,
018 * software distributed under the License is distributed on an
019 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
020 * KIND, either express or implied.  See the License for the
021 * specific language governing permissions and limitations
022 * under the License.
023 */
024
025/**
026 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
027 */
028public class DebugLoggerConsumerTest
029    extends TestCase
030{
031    private DebugLoggerConsumer debugConsumer;
032
033    public void setUp()
034        throws Exception
035    {
036        debugConsumer = new DebugLoggerConsumer( new DefaultLog() );
037    }
038
039    public void testErrorConsumer()
040    {
041        assertFalse( debugConsumer.isFed() );
042        debugConsumer.consumeLine( "Some line to consume" );
043        assertTrue( debugConsumer.isFed() );
044        debugConsumer.consumeLine( "Another line to consume" );
045        String ls = System.getProperty( "line.separator" );
046        assertEquals( "Contents were different!", "Some line to consume" + ls + "Another line to consume" + ls,
047                      debugConsumer.getOutput() );
048    }
049}