Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1486#discussion_r49084974
--- Diff:
flink-java/src/test/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatTest.java
---
@@ -0,0 +1,130 @@
+/*
+ * 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.flink.api.java.hadoop.mapreduce;
+
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.mapreduce.*;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class HadoopOutputFormatTest {
+
+ private static final String PATH = "an/ignored/file/";
+ private Map<String, Long> map;
+
+ @Test
+ public void testWriteRecord() {
+ OutputFormat<String, Long> dummyOutputFormat = new
DummyOutputFormat();
+ String key = "Test";
+ Long value = 1L;
+ map = new HashMap<>();
+ map.put(key, 0L);
+ try {
+ Job job = Job.getInstance();
+ Tuple2<String, Long> tuple = new Tuple2<>();
+ tuple.setFields(key, value);
+ HadoopOutputFormat<String, Long> hadoopOutputFormat = new
HadoopOutputFormat<>(dummyOutputFormat, job);
+
+ hadoopOutputFormat.recordWriter = new DummyRecordWriter();
+ hadoopOutputFormat.writeRecord(tuple);
+
+ Long expected = map.get(key);
+ assertEquals(expected, value);
+ } catch (IOException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void testOpen() {
--- End diff --
This method does not seem to test anything (except that no exception is
thrown).
Please add checks that the following methods are called:
- `setupJob()` method of the OutputCommitter
- `getRecordWriter()` method of the MapReduce OutputFormat
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---