001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.core.rolling;
015
016import ch.qos.logback.core.testUtil.CoreTestConstants;
017import ch.qos.logback.core.util.Compare;
018
019import java.io.IOException;
020import java.util.List;
021
022import static org.junit.Assert.assertTrue;
023
024public class ZRolloverChecker implements RolloverChecker {
025
026    String testId;
027
028    public ZRolloverChecker(String testId) {
029        this.testId = testId;
030    }
031
032    public void check(List<String> expectedFilenameList) throws IOException {
033        int lastIndex = expectedFilenameList.size() - 1;
034        String lastFile = expectedFilenameList.get(lastIndex);
035        String witnessFileName = CoreTestConstants.TEST_SRC_PREFIX + "witness/rolling/tbr-" + testId;
036        assertTrue(Compare.compare(lastFile, witnessFileName));
037    }
038}