diff --git a/common/src/test/java/io/netty/util/DefaultAttributeMapTest.java b/common/src/test/java/io/netty/util/DefaultAttributeMapTest.java index 97422ab645..a7c61cc9a4 100644 --- a/common/src/test/java/io/netty/util/DefaultAttributeMapTest.java +++ b/common/src/test/java/io/netty/util/DefaultAttributeMapTest.java @@ -15,66 +15,56 @@ */ package io.netty.util; -import static org.junit.Assert.assertEquals; -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 static org.junit.Assert.*; + import org.junit.Before; import org.junit.Test; public class DefaultAttributeMapTest { - + private DefaultAttributeMap map; - + @Before public void setup() { - this.map = new DefaultAttributeMap(); + map = new DefaultAttributeMap(); } - + @Test public void testMapExists() { - assertNotNull(this.map); + assertNotNull(map); } - + @Test public void testGetSetString() { AttributeKey key = new AttributeKey("Nothing"); - Attribute one = this.map.attr(key); - - assertSame(one, this.map.attr(key)); - + Attribute one = map.attr(key); + + assertSame(one, map.attr(key)); + one.setIfAbsent("Whoohoo"); - assertSame(one.get(), "Whoohoo"); - + one.setIfAbsent("What"); - assertNotSame(one.get(), "What"); - + one.remove(); - assertNull(one.get()); } - + @Test public void testGetSetInt() { AttributeKey key = new AttributeKey("Nada"); - Attribute one = this.map.attr(key); - - assertSame(one, this.map.attr(key)); - + Attribute one = map.attr(key); + + assertSame(one, map.attr(key)); + one.setIfAbsent(3653); - - assertEquals(one.get(), 3653); - + assertEquals(one.get(), Integer.valueOf(3653)); + one.setIfAbsent(1); - assertNotSame(one.get(), 1); - + one.remove(); - assertNull(one.get()); } - }