View Javadoc
1   package org.apache.maven.scm.provider.jazz.command.consumer;
2   
3   import junit.framework.TestCase;
4   import org.apache.maven.scm.log.DefaultLog;
5   
6   /*
7    * Licensed to the Apache Software Foundation (ASF) under one
8    * or more contributor license agreements.  See the NOTICE file
9    * distributed with this work for additional information
10   * regarding copyright ownership.  The ASF licenses this file
11   * to you under the Apache License, Version 2.0 (the
12   * "License"); you may not use this file except in compliance
13   * with the License.  You may obtain a copy of the License at
14   *
15   * http://www.apache.org/licenses/LICENSE-2.0
16   *
17   * Unless required by applicable law or agreed to in writing,
18   * software distributed under the License is distributed on an
19   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20   * KIND, either express or implied.  See the License for the
21   * specific language governing permissions and limitations
22   * under the License.
23   */
24  
25  /**
26   * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
27   */
28  public class DebugLoggerConsumerTest
29      extends TestCase
30  {
31      private DebugLoggerConsumer debugConsumer;
32  
33      public void setUp()
34          throws Exception
35      {
36          debugConsumer = new DebugLoggerConsumer( new DefaultLog() );
37      }
38  
39      public void testErrorConsumer()
40      {
41          assertFalse( debugConsumer.isFed() );
42          debugConsumer.consumeLine( "Some line to consume" );
43          assertTrue( debugConsumer.isFed() );
44          debugConsumer.consumeLine( "Another line to consume" );
45          String ls = System.getProperty( "line.separator" );
46          assertEquals( "Contents were different!", "Some line to consume" + ls + "Another line to consume" + ls,
47                        debugConsumer.getOutput() );
48      }
49  }