Author: thiru
Date: Tue Jan 26 18:28:43 2010
New Revision: 903351
URL: http://svn.apache.org/viewvc?rev=903351&view=rev
Log:
AVRO-375. Initializing uninizialized encoders fail
Added:
hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/io/TestEncoders.java
Added:
hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/io/TestEncoders.java
URL:
http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/io/TestEncoders.java?rev=903351&view=auto
==============================================================================
---
hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/io/TestEncoders.java
(added)
+++
hadoop/avro/trunk/lang/java/src/test/java/org/apache/avro/io/TestEncoders.java
Tue Jan 26 18:28:43 2010
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.avro.io;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.avro.Schema;
+import org.junit.Test;
+
+public class TestEncoders {
+ @Test
+ public void testBinaryEncoderInit() throws IOException {
+ OutputStream out = null;
+ new BinaryEncoder(out).init(new ByteArrayOutputStream());
+ }
+
+ @Test
+ public void testJsonEncoderInit() throws IOException {
+ Schema s = Schema.parse("\"int\"");
+ OutputStream out = null;
+ new JsonEncoder(s, out).init(new ByteArrayOutputStream());
+ }
+
+ @Test
+ public void testValidatingEncoderInit() throws IOException {
+ Schema s = Schema.parse("\"int\"");
+ OutputStream out = null;
+ Encoder e = new BinaryEncoder(out);
+ new ValidatingEncoder(s, e).init(new ByteArrayOutputStream());
+ }
+
+}