// Path: src/main/java/com/dsinpractice/samples/hadoop/mapred/wordcount/WCMapper.java
// public class WCMapper extends Mapper<Object, Text, Text, IntWritable> {
// 
//     private Pattern wordPattern
//             = Pattern.compile("[^a-z0-9]*([a-z0-9]+)[^a-z0-9]*");
// 
//     @Override
//     public void map(Object key, Text text, Context context)
//             throws IOException, InterruptedException {
//         String line = text.toString();
//         String[] tokens = line.split(" ");
//         for (String token : tokens) {
//             Matcher wordMatcher = wordPattern.matcher(token.toLowerCase());
//             if (wordMatcher.matches()) {
//                 String word = wordMatcher.group(1);
//                 context.write(new Text(word), new IntWritable(1));
//             } else {
//                 context.getCounter(SKIPPED_WORDS.MISMATCHED_WORD).increment(1);
//             }
//         }
//     }
// }


import com.dsinpractice.samples.hadoop.mapred.wordcount.WCMapper;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.junit.Test;
import java.io.IOException;
import static org.mockito.Mockito.*;
package com.dsinpractice.samples.hadoop.mapred.wordcount;




public class WCMapperTest {

    @Test
    public void should_count_each_word_in_line_as_one_occurrence() throws IOException, InterruptedException {
// Path: src/main/java/com/dsinpractice/samples/hadoop/mapred/wordcount/WCMapper.java
// public class WCMapper extends Mapper<Object, Text, Text, IntWritable> {
// 
//     private Pattern wordPattern
//             = Pattern.compile("[^a-z0-9]*([a-z0-9]+)[^a-z0-9]*");
// 
//     @Override
//     public void map(Object key, Text text, Context context)
//             throws IOException, InterruptedException {
//         String line = text.toString();
//         String[] tokens = line.split(" ");
//         for (String token : tokens) {
//             Matcher wordMatcher = wordPattern.matcher(token.toLowerCase());
//             if (wordMatcher.matches()) {
//                 String word = wordMatcher.group(1);
//                 context.write(new Text(word), new IntWritable(1));
//             } else {
//                 context.getCounter(SKIPPED_WORDS.MISMATCHED_WORD).increment(1);
//             }
//         }
//     }
// }


// Path: src/test/java/com/dsinpractice/samples/hadoop/mapred/wordcount/WCMapperTest.java
import com.dsinpractice.samples.hadoop.mapred.wordcount.WCMapper;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mrunit.mapreduce.MapDriver;
import org.junit.Test;
import java.io.IOException;
import static org.mockito.Mockito.*;

package com.dsinpractice.samples.hadoop.mapred.wordcount;




public class WCMapperTest {

    @Test
    public void should_count_each_word_in_line_as_one_occurrence() throws IOException, InterruptedException {
        WCMapper wcMapper = new WCMapper();