1   /*
2    * PRELYTIS.
3    * Copyright 2007, PRELYTIS S.A., and individual contributors
4    * as indicated by the @author tags. See the copyright.txt file in the
5    * distribution for a full listing of individual contributors.
6    *
7    * This is free software; you can redistribute it and/or modify it
8    * under the terms of the GNU Lesser General Public License as
9    * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */
22  
23  package org.jdbc4olap.jdbc;
24  
25  import junit.framework.TestCase;
26  
27  import java.sql.ResultSet;
28  import java.sql.SQLException;
29  
30  /**
31   * @author Dan Rollo
32   * Date: Jul 9, 2008
33   * Time: 12:36:17 PM
34   */
35  public class OlapResultSetTest extends TestCase {
36  
37      public void testCreate() throws Exception {
38          final OlapResultSet rs = new OlapResultSet();
39          assertEquals(true, rs.isBeforeFirst());
40          // @todo Restore when fixed
41          //assertNull(rs.getMetaData());
42      }
43  
44      public void testCreateEmptyResultSet() throws Exception {
45          OlapResultSetTest.assertEmptyResultSet(OlapResultSet.createEmptyResultSet());
46      }
47  
48      static void assertEmptyResultSet(final ResultSet rs) throws SQLException {
49          assertNotNull("ResultSet should be empty, but it is <null>", rs);
50          assertNotNull("Empty ResultSet is missing metadata.", rs.getMetaData());
51          assertEquals("Empty ResultSet has incorrent columnCount in metadata.", 0, rs.getMetaData().getColumnCount());
52      }
53  }