Package com.jetdrone.vertx.yoke.test

Source Code of com.jetdrone.vertx.yoke.test.ContextTest

package com.jetdrone.vertx.yoke.test;

import com.jetdrone.vertx.yoke.core.Context;
import org.junit.Test;

import java.util.*;

import static org.junit.Assert.*;

public class ContextTest {

    @Test
    public void testContext118_1() {
        Map<String, Object> ro = new HashMap<String, Object>() {{
            put("title", "ro-title");
        }};

        Context ctx = new Context(ro);
        ctx.put("title", "rw-title");

        Set<String> keys = ctx.keySet();
        Set<String> expectedKeys = new HashSet<String>() {{
            add("title");
        }};

        assertEquals(expectedKeys, keys);
    }

    @Test
    public void testContext118_2() {
        Map<String, Object> ro = new HashMap<String, Object>() {{
            put("title", "ro-title");
        }};

        Context ctx = new Context(ro);
        ctx.put("title", "rw-title");

        Collection<Object> values = ctx.values();
        Collection<Object> expectedValues = new LinkedList<Object>() {{
            add("rw-title");
        }};

        assertEquals(expectedValues, values);
    }

    @Test
    public void testContext118_3() {
        Map<String, Object> ro = new HashMap<String, Object>() {{
            put("title", "ro-title");
        }};

        Context ctx = new Context(ro);
        ctx.put("title", "rw-title");

        Set<Map.Entry<String, Object>> entrySet = ctx.entrySet();
        assertEquals(1, entrySet.size());
    }
}
TOP

Related Classes of com.jetdrone.vertx.yoke.test.ContextTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.