/**Copyright 2019 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/

package com.google.error_analyzer;

import com.google.error_analyzer.backend.Database;
import com.google.error_analyzer.backend.MockDatabase;
import java.util.ArrayList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.IOException;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public final class ErrorQueryTest {

    private final String filename = "file";
    private MockDatabase mockDatabase = null;

    @Mock
    Database database;

    @Rule
    public MockitoRule rule = MockitoJUnit.rule();

    @Before
    public void setUp() {
        mockDatabase = new MockDatabase();
    }

    @Test
    public void errorQueryTest() throws IOException {
        mockDatabase.errorQuery(filename);
        ArrayList<String> actual = mockDatabase.errorDatabase;
        when(database.errorQuery(filename)).thenReturn(true);
        ArrayList<String> expected = new ArrayList<String>();
        expected.add("Error: nullPointerException");
        expected.add("Severe: Could not find index file");
        expected.add("warning: NullPointerException");
        Assert.assertEquals(expected, actual);
    }
}
@@ -771,16 +771,40 @@
 Before;%0A
+import org.junit.After;%0A
 import o
@@ -814,24 +814,24 @@
 junit.Test;%0A
-
 import org.j
@@ -960,16 +960,44 @@
 o.Mock;%0A
+import org.mockito.Mockito;%0A
 import o
@@ -1067,16 +1067,99 @@
 o.when;%0A
+import static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.times;%0A
 import o
@@ -1621,17 +1621,106 @@
 ;%0A    %7D%0A
+    // @After%0A    // public void validate() %7B%0A    //     validateMockitoUsage();%0A    // %7D
 %0A
-
     @Tes
@@ -1939,24 +1939,63 @@
 turn(true);%0A
+        database.errorQuery(filename);%0A
         Arra
@@ -2152,24 +2152,24 @@
 dex file%22);%0A
-
         expe
@@ -2203,32 +2203,89 @@
 terException%22);%0A
+        verify(database, times(1)).errorQuery(filename);%0A
         Assert.a

Change in unit test