001: /*
002: * $Id: TestByteArrayBlob.java,v 1.2 2003/05/14 17:00:30 rwald Exp $
003: * =======================================================================
004: * Copyright (c) 2003 Axion Development Team. All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: *
010: * 1. Redistributions of source code must retain the above
011: * copyright notice, this list of conditions and the following
012: * disclaimer.
013: *
014: * 2. Redistributions in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * 3. The names "Tigris", "Axion", nor the names of its contributors may
020: * not be used to endorse or promote products derived from this
021: * software without specific prior written permission.
022: *
023: * 4. Products derived from this software may not be called "Axion", nor
024: * may "Tigris" or "Axion" appear in their names without specific prior
025: * written permission.
026: *
027: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
030: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
032: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
033: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
034: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
035: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
036: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
037: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
038: * =======================================================================
039: */
040:
041: package org.axiondb.types;
042:
043: import java.sql.Blob;
044: import java.sql.SQLException;
045:
046: import junit.framework.Test;
047: import junit.framework.TestSuite;
048:
049: import org.axiondb.jdbc.AxionBlob;
050:
051: /**
052: * @version $Revision: 1.2 $ $Date: 2003/05/14 17:00:30 $
053: * @author Rodney Waldhoff
054: */
055: public class TestByteArrayBlob extends AbstractBlobTest {
056:
057: public TestByteArrayBlob(String testName) {
058: super (testName);
059: }
060:
061: public static Test suite() {
062: return new TestSuite(TestByteArrayBlob.class);
063: }
064:
065: protected AxionBlob getBlob() throws Exception {
066: return new ByteArrayBlob(_bytes);
067: }
068:
069: public void testConstructorOnNull() throws Exception {
070: try {
071: new ByteArrayBlob(null);
072: fail("Expected NullPointerException");
073: } catch (NullPointerException e) {
074: // expected
075: }
076: }
077:
078: public void testTruncate() throws Exception {
079: AxionBlob blob = getBlob();
080: try {
081: blob.truncate(0);
082: fail("Expected SQLException"); // ok to implement, just isn't currently
083: } catch (SQLException e) {
084: // expected
085: }
086: }
087:
088: public void testSetBytes() throws Exception {
089: AxionBlob blob = getBlob();
090: try {
091: blob.setBytes(0, null, 0, 0);
092: fail("Expected SQLException"); // ok to implement, just isn't currently
093: } catch (SQLException e) {
094: // expected
095: }
096: }
097:
098: public void testSetBytes2() throws Exception {
099: AxionBlob blob = getBlob();
100: try {
101: blob.setBytes(0, null);
102: fail("Expected SQLException"); // ok to implement, just isn't currently
103: } catch (SQLException e) {
104: // expected
105: }
106: }
107:
108: public void testPosition() throws Exception {
109: AxionBlob blob = getBlob();
110: try {
111: blob.position((Blob) null, 0);
112: fail("Expected SQLException"); // ok to implement, just isn't currently
113: } catch (SQLException e) {
114: // expected
115: }
116: }
117:
118: public void testPosition2() throws Exception {
119: AxionBlob blob = getBlob();
120: try {
121: blob.position((byte[]) null, 0);
122: fail("Expected SQLException"); // ok to implement, just isn't currently
123: } catch (SQLException e) {
124: // expected
125: }
126: }
127:
128: public void testSetBinaryStream() throws Exception {
129: AxionBlob blob = getBlob();
130: try {
131: blob.setBinaryStream(0L);
132: fail("Expected SQLException"); // ok to implement, just isn't currently
133: } catch (SQLException e) {
134: // expected
135: }
136: }
137:
138: public void testSetBinaryStream2() throws Exception {
139: testSetBinaryStream();
140: }
141:
142: }
|