Home / Class/ SystemPropertyUtilTest Class — netty Architecture

SystemPropertyUtilTest Class — netty Architecture

Architecture documentation for the SystemPropertyUtilTest class in SystemPropertyUtilTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c4e85b19_8734_3e64_5804_a57978d77db9["SystemPropertyUtilTest"]
  92561920_7a4f_3c54_f73a_7c13cde2d77e["SystemPropertyUtilTest.java"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|defined in| 92561920_7a4f_3c54_f73a_7c13cde2d77e
  e2ba9ff8_16a4_7f1b_f956_00e29fd8b3ad["clearSystemPropertyBeforeEach()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| e2ba9ff8_16a4_7f1b_f956_00e29fd8b3ad
  da70cbea_57c5_0fc9_6064_c5a90b43e4ac["testGetWithKeyNull()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| da70cbea_57c5_0fc9_6064_c5a90b43e4ac
  15db47a0_9264_dde5_642e_5e08b640d1a5["testGetWithKeyEmpty()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 15db47a0_9264_dde5_642e_5e08b640d1a5
  2a48fe28_eb9a_bfa0_4af9_aa99d4ff54ca["testGetDefaultValueWithPropertyNull()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 2a48fe28_eb9a_bfa0_4af9_aa99d4ff54ca
  7fc558d6_71a7_1d50_bf04_ee7c94f7b287["testGetPropertyValue()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 7fc558d6_71a7_1d50_bf04_ee7c94f7b287
  198dee4d_7fa2_52d0_e3b0_b45a5cb6eb87["testGetBooleanDefaultValueWithPropertyNull()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 198dee4d_7fa2_52d0_e3b0_b45a5cb6eb87
  2d1a375c_a074_537a_895d_26cbdbd51a63["testGetBooleanDefaultValueWithEmptyString()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 2d1a375c_a074_537a_895d_26cbdbd51a63
  6ea03f0b_de16_aae0_7c2c_fbdd018115b2["testGetBooleanWithTrueValue()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 6ea03f0b_de16_aae0_7c2c_fbdd018115b2
  99c60f81_dfdc_1a07_8241_c7d8b651d555["testGetBooleanWithFalseValue()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 99c60f81_dfdc_1a07_8241_c7d8b651d555
  619fe442_13de_8fda_7cca_799d8b24b507["testGetBooleanDefaultValueWithWrongValue()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| 619fe442_13de_8fda_7cca_799d8b24b507
  b0fcd626_e3f8_3098_2dfc_d797a1f0bbcc["getIntDefaultValueWithPropertyNull()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| b0fcd626_e3f8_3098_2dfc_d797a1f0bbcc
  a2389464_1220_1c7c_804f_1e817769c44f["getIntWithPropertValueIsInt()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| a2389464_1220_1c7c_804f_1e817769c44f
  b9edf964_e026_f760_29ad_232d4de69773["getIntDefaultValueWithPropertValueIsNotInt()"]
  c4e85b19_8734_3e64_5804_a57978d77db9 -->|method| b9edf964_e026_f760_29ad_232d4de69773

Relationship Graph

Source Code

common/src/test/java/io/netty/util/internal/SystemPropertyUtilTest.java lines 27–140

public class SystemPropertyUtilTest {

    @BeforeEach
    public void clearSystemPropertyBeforeEach() {
        System.clearProperty("key");
    }

    @Test
    public void testGetWithKeyNull() {
        assertThrows(NullPointerException.class, new Executable() {
            @Override
            public void execute() {
                SystemPropertyUtil.get(null, null);
            }
        });
    }

    @Test
    public void testGetWithKeyEmpty() {
        assertThrows(IllegalArgumentException.class, new Executable() {
            @Override
            public void execute() {
                SystemPropertyUtil.get("", null);
            }
        });
    }

    @Test
    public void testGetDefaultValueWithPropertyNull() {
        assertEquals("default", SystemPropertyUtil.get("key", "default"));
    }

    @Test
    public void testGetPropertyValue() {
        System.setProperty("key", "value");
        assertEquals("value", SystemPropertyUtil.get("key"));
    }

    @Test
    public void testGetBooleanDefaultValueWithPropertyNull() {
        assertTrue(SystemPropertyUtil.getBoolean("key", true));
        assertFalse(SystemPropertyUtil.getBoolean("key", false));
    }

    @Test
    public void testGetBooleanDefaultValueWithEmptyString() {
        System.setProperty("key", "");
        assertTrue(SystemPropertyUtil.getBoolean("key", true));
        assertFalse(SystemPropertyUtil.getBoolean("key", false));
    }

    @Test
    public void testGetBooleanWithTrueValue() {
        System.setProperty("key", "true");
        assertTrue(SystemPropertyUtil.getBoolean("key", false));
        System.setProperty("key", "yes");
        assertTrue(SystemPropertyUtil.getBoolean("key", false));
        System.setProperty("key", "1");
        assertTrue(SystemPropertyUtil.getBoolean("key", true));
    }

    @Test
    public void testGetBooleanWithFalseValue() {
        System.setProperty("key", "false");
        assertFalse(SystemPropertyUtil.getBoolean("key", true));
        System.setProperty("key", "no");
        assertFalse(SystemPropertyUtil.getBoolean("key", false));
        System.setProperty("key", "0");
        assertFalse(SystemPropertyUtil.getBoolean("key", true));
    }

    @Test
    public void testGetBooleanDefaultValueWithWrongValue() {
        System.setProperty("key", "abc");
        assertTrue(SystemPropertyUtil.getBoolean("key", true));
        System.setProperty("key", "123");
        assertFalse(SystemPropertyUtil.getBoolean("key", false));
    }

    @Test
    public void getIntDefaultValueWithPropertyNull() {

Frequently Asked Questions

What is the SystemPropertyUtilTest class?
SystemPropertyUtilTest is a class in the netty codebase, defined in common/src/test/java/io/netty/util/internal/SystemPropertyUtilTest.java.
Where is SystemPropertyUtilTest defined?
SystemPropertyUtilTest is defined in common/src/test/java/io/netty/util/internal/SystemPropertyUtilTest.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free