### Question:
LogUtil { public static int findMessage(String expectedMessage) { int count = 0; List<Log> logList = DubboAppender.logList; for (int i = 0; i < logList.size(); i++) { String logMessage = logList.get(i).getLogMessage(); if (logMessage.contains(expectedMessage)) { 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);  }### Answer:
@Test public void testFindMessage1() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogMessage()).thenReturn("message"); assertThat(LogUtil.findMessage("message"), equalTo(1)); }
@Test public void testFindMessage2() throws Exception { Log log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogMessage()).thenReturn("message"); when(log.getLogLevel()).thenReturn(Level.ERROR); log = mock(Log.class); DubboAppender.logList.add(log); when(log.getLogMessage()).thenReturn("message"); when(log.getLogLevel()).thenReturn(Level.INFO); assertThat(LogUtil.findMessage(Level.ERROR, "message"), equalTo(1)); }