package com.hpcloud.maas.infrastructure.thresholding;

import static org.testng.Assert.assertEquals;

import java.util.Collections;
import java.util.List;

import org.testng.annotations.Test;

import com.hpcloud.maas.common.model.metric.FlatMetric;
import com.hpcloud.maas.common.model.metric.FlatMetrics;

/**
 * @author Jonathan Halterman
 */
@Test
public class MaasMetricDeserializerTest {
  private MaasMetricDeserializer deserializer = new MaasMetricDeserializer();

  public void shouldDeserialize() {
    FlatMetric initial = new FlatMetric("bob", "test", "1", null, 123, 5.0);
    List<List<?>> metrics = deserializer.deserialize(FlatMetrics.toJson(initial));
    assertEquals(metrics, Collections.singletonList(Collections.singletonList(initial.toMetric())));
  }
}

@@ -95,16 +95,41 @@
 quals;%0A%0A
+import java.util.Arrays;%0A
 import j
@@ -150,16 +150,16 @@
 ctions;%0A
-
 import j
@@ -323,16 +323,68 @@
 Metrics;
+%0Aimport com.hpcloud.maas.common.model.metric.Metric;
 %0A%0A/**%0A *
@@ -738,16 +738,58 @@
 tial));%0A
+    Metric expected = initial.toMetric();%0A
     asse
@@ -836,52 +836,51 @@
 ist(
-Collections.singletonList(initial.toMetric()
+Arrays.asList(expected.definition, expected
 )));

Test fix