View Javadoc
1   /*
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2022, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core.status.testUtil;
15  
16  import ch.qos.logback.core.Context;
17  import ch.qos.logback.core.status.StatusManager;
18  import ch.qos.logback.core.status.StatusUtil;
19  import org.junit.jupiter.api.Assertions;
20  
21  /**
22   * Extend StatusUtil with assertions.
23   */
24  public class StatusChecker extends StatusUtil {
25  
26      public StatusChecker(StatusManager sm) {
27          super(sm);
28      }
29  
30      public StatusChecker(Context context) {
31          super(context);
32      }
33  
34      public void assertContainsMatch(int level, String regex) {
35          Assertions.assertTrue(containsMatch(level, regex));
36      }
37  
38      public void assertNoMatch(String regex) {
39          Assertions.assertFalse(containsMatch(regex));
40      }
41  
42      public void assertContainsMatch(String regex) {
43          Assertions.assertTrue(containsMatch(regex));
44      }
45  
46      public void assertContainsException(Class<?> scanExceptionClass) {
47          Assertions.assertTrue(containsException(scanExceptionClass));
48      }
49  
50      public void assertContainsException(Class<?> scanExceptionClass, String msg) {
51          Assertions.assertTrue(containsException(scanExceptionClass, msg));
52      }
53      
54      public void assertIsErrorFree() {
55          Assertions.assertTrue(isErrorFree(0));
56      }
57  
58      public void assertIsErrorFree(long treshhold) {
59          Assertions.assertTrue(isErrorFree(0));
60      }
61  
62      public void assertIsWarningOrErrorFree() {
63          Assertions.assertTrue(isWarningOrErrorFree(0));
64      }
65  
66      public void assertErrorCount(int i) {
67      }
68  }