View Javadoc

1   /*
2    * Derivative Work
3    * Copyright 2010 SOFTEC sa. All rights reserved.
4    *
5    * Original Work
6    * Copyright 2010 Justin Searls
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package searls.jasmine.format;
22  
23  import org.apache.maven.plugin.logging.Log;
24  
25  import searls.jasmine.model.JasmineResult;
26  
27  public class JasmineResultLogger {
28  
29  	public static final String HEADER="\n"+
30  		"-------------------------------------------------------\n"+
31  		" J A S M I N E   T E S T S  -  %BROWSER%\n" +
32  		"-------------------------------------------------------";
33  	public static final String FAIL_APPENDAGE = " <<< FAILURE!";
34  	public static final String INDENT = "  ";
35  	
36  	private Log log;
37  
38      private String browser;
39  
40      public void setLog(Log log) {
41  		this.log = log;
42  	}
43  
44  	public void log(JasmineResult result) {
45  		log.info(HEADER.replaceAll("%BROWSER%",browser));
46  		
47  		log.info(result.getDetails());
48  
49  		log.info("\nResults:\n\n"+result.getDescription()+"\n");
50  	}
51  
52      public void setBrowser(String browser)
53      {
54          this.browser = browser;
55      }
56  }