public class TimeMachineUnmarshallerTest extends UnmarshallerTestCase {
@Test
public void test_to_model() throws Exception {
TimeMachine timeMachine = new TimeMachineUnmarshaller().toModel(loadFile("/timemachine/timemachine.json"));
// columns
assertThat(timeMachine.getColumns().length).isEqualTo(2);
assertThat(timeMachine.getColumns()[0].getIndex()).isEqualTo(0);
assertThat(timeMachine.getColumns()[0].getMetricKey()).isEqualTo("ncloc");
assertThat(timeMachine.getColumns()[1].getIndex()).isEqualTo(1);
assertThat(timeMachine.getColumns()[1].getMetricKey()).isEqualTo("coverage");
// values sorted by date
assertThat(timeMachine.getCells().length).isEqualTo(3); // 3 days
assertThat(getDayOfMonth(timeMachine.getCells()[0].getDate())).isEqualTo(19);
assertThat(getDayOfMonth(timeMachine.getCells()[1].getDate())).isEqualTo(21);
assertThat(getDayOfMonth(timeMachine.getCells()[2].getDate())).isEqualTo(25);
assertThat(timeMachine.getCells()[0].getValues()).hasSize(2);
assertThat((Double) timeMachine.getCells()[0].getValues()[0]).isEqualTo(21.0);
assertThat((Double) timeMachine.getCells()[0].getValues()[1]).isEqualTo(80.0);
}