public class SettingsTest extends AbstractTest
{
@Test
public void testSettingsUsage() throws Exception
{
Settings settings = new Settings();
int streamsValue = 100;
settings.put(new Settings.Setting(Settings.ID.MAX_CONCURRENT_STREAMS, Settings.Flag.PERSIST, streamsValue));
int windowValue = 32768;
settings.put(new Settings.Setting(Settings.ID.INITIAL_WINDOW_SIZE, windowValue));
int newCode = 91;
Settings.ID newID = Settings.ID.from(newCode);
int newValue = 97;
settings.put(new Settings.Setting(newID, newValue));
Settings.Setting setting1 = settings.get(Settings.ID.MAX_CONCURRENT_STREAMS);
Assert.assertSame(Settings.ID.MAX_CONCURRENT_STREAMS, setting1.id());
Assert.assertSame(Settings.Flag.PERSIST, setting1.flag());
Assert.assertEquals(streamsValue, setting1.value());
Settings.Setting setting2 = settings.get(Settings.ID.INITIAL_WINDOW_SIZE);
Assert.assertSame(Settings.ID.INITIAL_WINDOW_SIZE, setting2.id());
Assert.assertSame(Settings.Flag.NONE, setting2.flag());
Assert.assertEquals(windowValue, setting2.value());
int size = settings.size();
Settings.Setting setting3 = settings.remove(Settings.ID.from(newCode));
Assert.assertEquals(size - 1, settings.size());
Assert.assertNotNull(setting3);
Assert.assertSame(newID, setting3.id());
Assert.assertEquals(newValue, setting3.value());
}