01: package com.mockrunner.test.jdbc;
02:
03: import java.sql.ParameterMetaData;
04:
05: import junit.framework.TestCase;
06:
07: import com.mockrunner.mock.jdbc.MockParameterMetaData;
08:
09: public class MockParameterMetaDataTest extends TestCase {
10: private MockParameterMetaData metaData;
11:
12: protected void setUp() throws Exception {
13: metaData = new MockParameterMetaData();
14: }
15:
16: protected void tearDown() throws Exception {
17: metaData = null;
18: }
19:
20: public void testSetAndGet() throws Exception {
21: metaData.setParameterClassName(1, "ClassName");
22: metaData.setPrecision(2, 3);
23: metaData.setSigned(1, true);
24: metaData.setParameterCount(5);
25: metaData.setParameterMode(1, ParameterMetaData.parameterModeIn);
26: assertEquals("ClassName", metaData.getParameterClassName(1));
27: assertEquals(Object.class.getName(), metaData
28: .getParameterClassName(2));
29: assertEquals(3, metaData.getPrecision(2));
30: assertEquals(0, metaData.getPrecision(1));
31: assertTrue(metaData.isSigned(1));
32: assertFalse(metaData.isSigned(2));
33: assertEquals(5, metaData.getParameterCount());
34: assertEquals(ParameterMetaData.parameterModeIn, metaData
35: .getParameterMode(1));
36: assertEquals(ParameterMetaData.parameterModeUnknown, metaData
37: .getParameterMode(2));
38: }
39: }
|