@@ -0,0 +1,2896 @@
+/*%0A * #%25L%0A * servo%0A * %25%25%0A * Copyright (C) 2011 - 2012 Netflix%0A * %25%25%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *      http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * #L%25%0A */%0Apackage com.netflix.servo.publish;%0A%0Aimport com.google.common.collect.ImmutableMap;%0A%0Aimport java.util.Map;%0A%0Aimport org.testng.annotations.Test;%0A%0Aimport static org.testng.Assert.*;%0A%0Apublic class MetricTest %7B%0A%0A    private final Map%3CString,String%3E tags1 =%0A        ImmutableMap.of(%22cluster%22, %22foo%22, %22asg%22, %22foo-v000%22);%0A%0A    private final Map%3CString,String%3E tags2 =%0A        ImmutableMap.of(%22cluster%22, %22foo%22, %22asg%22, %22foo-v001%22);%0A%0A    @Test(expectedExceptions = NullPointerException.class)%0A    public void testNullName() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        new Metric(null, tags1, now, 42);%0A    %7D%0A%0A    @Test(expectedExceptions = NullPointerException.class)%0A    public void testNullTags() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        new Metric(%22a%22, null, now, 42);%0A    %7D%0A%0A    @Test(expectedExceptions = NullPointerException.class)%0A    public void testNullValue() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        new Metric(%22a%22, tags1, now, null);%0A    %7D%0A%0A    @Test%0A    public void testAccessors() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        Metric m1 = new Metric(%22a%22, tags1, now, 42);%0A        assertEquals(m1.name(), %22a%22);%0A        assertEquals(m1.tags(), tags1);%0A        assertEquals(m1.timestamp(), now);%0A        assertEquals(m1.value(), 42);%0A    %7D%0A%0A    @Test%0A    public void testEquals() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        Metric m1 = new Metric(%22a%22, tags1, now, 42);%0A        Metric m2 = new Metric(%22a%22, tags2, now, 42);%0A        Metric m3 = new Metric(%22a%22, tags1, now, 42);%0A%0A        assertFalse(m1.equals(null));%0A        assertFalse(m1.equals(m2.toString()));%0A        assertTrue(m1.equals(m1));%0A        assertFalse(m1.equals(m2));%0A        assertTrue(m1.equals(m3));%0A    %7D%0A%0A    @Test%0A    public void testHashCode() throws Exception %7B%0A        long now = System.currentTimeMillis();%0A        Metric m1 = new Metric(%22a%22, tags1, now, 42);%0A        Metric m2 = new Metric(%22a%22, tags2, now, 42);%0A        Metric m3 = new Metric(%22a%22, tags1, now, 42);%0A%0A        assertTrue(m1.hashCode() == m1.hashCode());%0A        assertTrue(m1.hashCode() != m2.hashCode());%0A        assertTrue(m1.hashCode() == m3.hashCode());%0A    %7D%0A%7D%0A

add test case for metric class