package org.nudge.elasticstack.bean.rawdata;

import com.nudge.apm.buffer.probe.RawDataProtocol;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.*;

/**
 *
 */
public class FredBuilderTest {

    private static final Logger LOG = Logger.getLogger(FredBuilderTest.class);

    private RawDataProtocol.RawData rawData;

    @Before
    public void readRawdata() {
        try {
            rawData = RawDataProtocol.RawData.parseFrom(this.getClass().getClassLoader().getResourceAsStream("rawdata/collecte_2016-09-29_10-54-01-620_140.dat"));
        } catch (IOException e) {
            LOG.error("Impossible to read the sample rawdata", e);
        }
    }

    @Test
    public void buildTransactions() throws Exception {
        List<TransactionFred> transactionFredList = FredBuilder.buildTransactions(rawData.getTransactionsList());

        //test -assertions
        RawDataProtocol.Transaction expectedTrans = rawData.getTransactionsList().get(0);
        TransactionFred transaction = transactionFredList.get(0);

        Assert.assertEquals(expectedTrans.getCode(), transaction.getCode());
        Assert.assertEquals(expectedTrans.getStartTime(), transaction.getStartTime());
        Assert.assertEquals(expectedTrans.getEndTime(), transaction.getEndTime());


    }

    @Test
    public void buildMbeans() throws Exception {

    }

}
@@ -245,70 +245,12 @@
 til.
-Date;%0Aimport java.util.List;%0A%0Aimport static org.junit.Assert.*
+List
 ;%0A%0A/
@@ -1367,17 +1367,563 @@
 ime());%0A
-%0A
+        Assert.assertEquals(expectedTrans.getUserIp(), transaction.getUserIp());%0A        Assert.assertEquals(expectedTrans.getLayersList().size(), transaction.getLayers().size());%0A%0A        RawDataProtocol.Layer expectedLayer = expectedTrans.getLayersList().get(0);%0A        LayerFred layer = transaction.getLayers().get(0);%0A        Assert.assertEquals(expectedLayer.getLayerName(), layer.getLayerName());%0A        Assert.assertEquals(expectedLayer.getTime(), layer.getTime());%0A        Assert.assertEquals(expectedLayer.getCount(), layer.getCount());
 %0A    %7D%0A%0A

Update unit test