package es.tid.cosmos.mobility.adjacentextraction;

import static java.util.Arrays.asList;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
import org.junit.Before;
import org.junit.Test;

import es.tid.cosmos.base.data.TypedProtobufWritable;
import es.tid.cosmos.mobility.data.TwoIntUtil;
import es.tid.cosmos.base.data.generated.BaseTypes.Int;
import es.tid.cosmos.mobility.data.generated.MobProtocol.TwoInt;

/**
 *
 * @author dmicol
 */
public class AdjSpreadCountReducerTest {
    private ReduceDriver<LongWritable, TypedProtobufWritable<TwoInt>, LongWritable,
            TypedProtobufWritable<Int>> driver;
    
    @Before
    public void setUp() {
        this.driver = new ReduceDriver<LongWritable, TypedProtobufWritable<TwoInt>,
                LongWritable, TypedProtobufWritable<Int>>(
                        new AdjSpreadCountReducer());
    }

    @Test
    public void testReduce() {
        final TypedProtobufWritable<TwoInt> value1 = new TypedProtobufWritable<TwoInt>(
                TwoIntUtil.create(100L, 200L));
        final TypedProtobufWritable<TwoInt> value2 = new TypedProtobufWritable<TwoInt>(
                TwoIntUtil.create(300L, 400L));
        this.driver
                .withInput(new LongWritable(57L), asList(value1, value2))
                .withOutput(new LongWritable(0L), TypedProtobufWritable.create(2))
                .runTest();
    }
}

@@ -311,88 +311,90 @@
 mos.
-mobility.data.TwoIntUtil;%0Aimport es.tid.cosmos.base.data.generated.BaseTypes.Int
+base.data.generated.BaseTypes.Int64;%0Aimport es.tid.cosmos.mobility.data.TwoIntUtil
 ;%0Aim
@@ -596,16 +596,28 @@
 TwoInt%3E,
+%0A           
  LongWri
@@ -622,28 +622,16 @@
 ritable,
-%0A           
  TypedPr
@@ -648,16 +648,18 @@
 able%3CInt
+64
 %3E%3E drive
@@ -780,32 +780,32 @@
 itable%3CTwoInt%3E,%0A
-
                 
@@ -843,16 +843,18 @@
 able%3CInt
+64
 %3E%3E(%0A    
@@ -1397,16 +1397,17 @@
 create(2
+L
 ))%0A     

Fix also AdjSpreadCountReducerTest