Fix compiler warnings

This commit is contained in:
Trustin Lee 2012-09-01 16:58:33 +09:00
parent 5c347c5683
commit 85f8247cef

View File

@ -15,66 +15,56 @@
*/ */
package io.netty.util; package io.netty.util;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class DefaultAttributeMapTest { public class DefaultAttributeMapTest {
private DefaultAttributeMap map; private DefaultAttributeMap map;
@Before @Before
public void setup() { public void setup() {
this.map = new DefaultAttributeMap(); map = new DefaultAttributeMap();
} }
@Test @Test
public void testMapExists() { public void testMapExists() {
assertNotNull(this.map); assertNotNull(map);
} }
@Test @Test
public void testGetSetString() { public void testGetSetString() {
AttributeKey<String> key = new AttributeKey<String>("Nothing"); AttributeKey<String> key = new AttributeKey<String>("Nothing");
Attribute one = this.map.attr(key); Attribute<String> one = map.attr(key);
assertSame(one, this.map.attr(key)); assertSame(one, map.attr(key));
one.setIfAbsent("Whoohoo"); one.setIfAbsent("Whoohoo");
assertSame(one.get(), "Whoohoo"); assertSame(one.get(), "Whoohoo");
one.setIfAbsent("What"); one.setIfAbsent("What");
assertNotSame(one.get(), "What"); assertNotSame(one.get(), "What");
one.remove(); one.remove();
assertNull(one.get()); assertNull(one.get());
} }
@Test @Test
public void testGetSetInt() { public void testGetSetInt() {
AttributeKey<Integer> key = new AttributeKey<Integer>("Nada"); AttributeKey<Integer> key = new AttributeKey<Integer>("Nada");
Attribute one = this.map.attr(key); Attribute<Integer> one = map.attr(key);
assertSame(one, this.map.attr(key)); assertSame(one, map.attr(key));
one.setIfAbsent(3653); one.setIfAbsent(3653);
assertEquals(one.get(), Integer.valueOf(3653));
assertEquals(one.get(), 3653);
one.setIfAbsent(1); one.setIfAbsent(1);
assertNotSame(one.get(), 1); assertNotSame(one.get(), 1);
one.remove(); one.remove();
assertNull(one.get()); assertNull(one.get());
} }
} }