UtilsTest.java 647 字节
Newer Older
oldratlee's avatar
oldratlee 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
package com.alibaba.ttl.threadpool.agent.internal.transformlet.impl;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.fail;

public class UtilsTest {
    @Test
    public void test_get_unboxing_boolean_fromMap() {
        Map<String, Object> map = new HashMap<String, Object>();

        try {
            getUnboxingBoolean(map, "not_existed");
            fail();
        } catch (NullPointerException expected) {
            // do nothing
        }
    }

    private static boolean getUnboxingBoolean(Map<String, Object> map, String key) {
        return (Boolean) map.get(key);
    }
}