@Test
public void testInsertAssertion() throws Exception {

    
    JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
    Assertion assertion = new Assertion()
            .setAction("read")
            .setEffect(AssertionEffect.ALLOW)
            .setResource("my-domain:*")
            .setRole("my-domain:role.role1");
    Mockito.when(mockResultSet.getInt(1))
        .thenReturn(5) // domain id
        .thenReturn(7); // policy id
    Mockito.when(mockResultSet.next())
        .thenReturn(true) // this one is for domain id
        .thenReturn(true) // this one is for policy id
        .thenReturn(false); // insertion is not found
    Mockito.doReturn(1).when(mockPrepStmt).executeUpdate();
    boolean requestSuccess = jdbcConn.insertAssertion("my-domain", "policy1", assertion);
    assertTrue(requestSuccess);
    // getting domain and policy ids
    
    Mockito.verify(mockPrepStmt, times(1)).setString(1, "my-domain");
    Mockito.verify(mockPrepStmt, times(1)).setInt(1, 5);
    Mockito.verify(mockPrepStmt, times(1)).setString(2, "policy1");
    
    // assertion statement - twice once for checking if it exists
    // and second time for inserting
    
    Mockito.verify(mockPrepStmt, times(2)).setInt(1, 7);
    Mockito.verify(mockPrepStmt, times(2)).setString(2, "role1");
    Mockito.verify(mockPrepStmt, times(2)).setString(3, "my-domain:*");
    Mockito.verify(mockPrepStmt, times(2)).setString(4, "read");
    Mockito.verify(mockPrepStmt, times(2)).setString(5, "ALLOW");
    jdbcConn.close();
}