001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.terminal.report; 018 019import java.nio.file.*; 020 021/** 022 * Reads one test-report format. 023 * 024 * <p> 025 * A reader <b>never throws for bad input</b>. A missing, unreadable, oversize, malformed or truncated file yields a 026 * result with the tests that could be recovered and a warning. Readers are stateless and thread-safe. 027 */ 028public interface ReportReader { 029 030 /** 031 * Returns the default framework key for the tests this reader produces. 032 * 033 * @return The key, for example <c>surefire</c> or <c>jest</c>. 034 */ 035 String fw(); 036 037 /** 038 * Reads a report. 039 * 040 * @param path The report file (or, for Surefire, a directory of them). 041 * @param limits The bounds to apply. 042 * @return The result; never <jk>null</jk>. 043 */ 044 ReportResult read(Path path, ReportLimits limits); 045 046 /** 047 * Reads a report with {@link ReportLimits#DEFAULT}. 048 * 049 * @param path The report file or directory. 050 * @return The result; never <jk>null</jk>. 051 */ 052 default ReportResult read(Path path) { 053 return read(path, ReportLimits.DEFAULT); 054 } 055}