KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > codec > BinaryEncoderAbstractTest


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.commons.codec;
18
19 import junit.framework.TestCase;
20
21 /**
22  * @version $Id: BinaryEncoderAbstractTest.java,v 1.9 2004/04/19 01:14:28 ggregory Exp $
23  * @author Apache Software Foundation
24  */

25 public abstract class BinaryEncoderAbstractTest extends TestCase {
26
27     public BinaryEncoderAbstractTest(String JavaDoc name) {
28         super(name);
29     }
30
31     protected abstract BinaryEncoder makeEncoder();
32
33     // ------------------------------------------------------------------------
34

35     public void testEncodeEmpty() throws Exception JavaDoc {
36         BinaryEncoder encoder = makeEncoder();
37         encoder.encode(new byte[0]);
38     }
39
40     public void testEncodeNull() throws Exception JavaDoc {
41         BinaryEncoder encoder = makeEncoder();
42     try {
43         encoder.encode(null);
44     } catch( EncoderException ee ) {
45         // An exception should be thrown
46
}
47     }
48 }
49
Popular Tags