LogUtil { public static int findLevelWithThreadName(Level expectedLevel, String threadName) { int count = 0; List<Log> logList = DubboAppender.logList; for (int i = 0; i < logList.size(); i++) { Log log = logList.get(i); if (log.getLogLevel().equals(expectedLevel) && log.getLogThread().equals(threadName)) { count++; } } return count; }  static void start(); static void stop(); static boolean checkNoError(); static int findName(String expectedLogName); static int findLevel(Level expectedLevel); static int findLevelWithThreadName(Level expectedLevel, String threadName); static int findThread(String expectedThread); static int findMessage(String expectedMessage); static int findMessage(Level expectedLevel, String expectedMessage); static void printList(List<T> list);  }
@Test public void testFindLevelWithThreadName() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogLevel()).thenReturn(Level.ERROR); when(log.getLogThread()).thenReturn("thread-1"); log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogLevel()).thenReturn(Level.ERROR); when(log.getLogThread()).thenReturn("thread-2"); assertThat(LogUtil.findLevelWithThreadName(Level.ERROR, "thread-2"), equalTo(1)); }