Home / Class/ DomainNameMappingTest Class — netty Architecture

DomainNameMappingTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  a7e40a68_a0cc_c785_e126_3c2e680ed006["DomainNameMappingTest"]
  ca9d01b7_bcf7_2793_e288_08181bf8cd5f["DomainNameMappingTest.java"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|defined in| ca9d01b7_bcf7_2793_e288_08181bf8cd5f
  e89989b7_db47_c6b2_a37b_10c27d5ac04c["testNullDefaultValueInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| e89989b7_db47_c6b2_a37b_10c27d5ac04c
  f0a0df78_f10d_67f9_75d8_53ddd520dd7b["testNullDomainNamePatternsAreForbiddenInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| f0a0df78_f10d_67f9_75d8_53ddd520dd7b
  7b25c798_2887_be99_6f02_b78b37526856["testNullValuesAreForbiddenInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 7b25c798_2887_be99_6f02_b78b37526856
  4644ba63_559c_4f17_6164_edeaab384a1f["testDefaultValueInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 4644ba63_559c_4f17_6164_edeaab384a1f
  c14293cf_539c_4866_55a7_0f14926a354d["testStrictEqualityInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| c14293cf_539c_4866_55a7_0f14926a354d
  666360f3_3d72_e430_6df6_6536f34e6cc3["testWildcardMatchesAnyPrefixInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 666360f3_3d72_e430_6df6_6536f34e6cc3
  ee243c6a_b335_f964_2074_51ac1a71dba4["testFirstMatchWinsInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| ee243c6a_b335_f964_2074_51ac1a71dba4
  962e1915_2236_8848_9355_4d897cc3bd36["testToStringInDeprecatedApi()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 962e1915_2236_8848_9355_4d897cc3bd36
  5b52c511_fbb8_e584_b7e9_191a9270e000["testNullDefaultValue()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 5b52c511_fbb8_e584_b7e9_191a9270e000
  9b7676f8_6505_31d3_7887_bb4113339384["testNullDomainNamePatternsAreForbidden()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 9b7676f8_6505_31d3_7887_bb4113339384
  f1ec105d_4d4a_053a_f321_f75ebea289f3["testNullValuesAreForbidden()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| f1ec105d_4d4a_053a_f321_f75ebea289f3
  fc0b14a2_bfab_c96e_e399_666850d39a39["testDefaultValue()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| fc0b14a2_bfab_c96e_e399_666850d39a39
  9029f116_2981_52b8_b765_08e9bda1d83c["testStrictEquality()"]
  a7e40a68_a0cc_c785_e126_3c2e680ed006 -->|method| 9029f116_2981_52b8_b765_08e9bda1d83c

Relationship Graph

Source Code

common/src/test/java/io/netty/util/DomainNameMappingTest.java lines 27–246

@SuppressWarnings("deprecation")
public class DomainNameMappingTest {

    // Deprecated API

    @Test
    public void testNullDefaultValueInDeprecatedApi() {
        assertThrows(NullPointerException.class, new Executable() {
            @Override
            public void execute() {
                new DomainNameMapping<String>(null);
            }
        });
    }

    @Test
    public void testNullDomainNamePatternsAreForbiddenInDeprecatedApi() {
        assertThrows(NullPointerException.class, new Executable() {
            @Override
            public void execute() {
                new DomainNameMapping<String>("NotFound").add(null, "Some value");
            }
        });
    }

    @Test
    public void testNullValuesAreForbiddenInDeprecatedApi() {
        assertThrows(NullPointerException.class, new Executable() {
            @Override
            public void execute() {
                new DomainNameMapping<String>("NotFound").add("Some key", null);
            }
        });
    }

    @Test
    public void testDefaultValueInDeprecatedApi() {
        DomainNameMapping<String> mapping = new DomainNameMapping<String>("NotFound");

        assertEquals("NotFound", mapping.map("not-existing"));

        mapping.add("*.netty.io", "Netty");

        assertEquals("NotFound", mapping.map("not-existing"));
    }

    @Test
    public void testStrictEqualityInDeprecatedApi() {
        DomainNameMapping<String> mapping = new DomainNameMapping<String>("NotFound")
            .add("netty.io", "Netty")
            .add("downloads.netty.io", "Netty-Downloads");

        assertEquals("Netty", mapping.map("netty.io"));
        assertEquals("Netty-Downloads", mapping.map("downloads.netty.io"));

        assertEquals("NotFound", mapping.map("x.y.z.netty.io"));
    }

    @Test
    public void testWildcardMatchesAnyPrefixInDeprecatedApi() {
        DomainNameMapping<String> mapping = new DomainNameMapping<String>("NotFound")
            .add("*.netty.io", "Netty");

        assertEquals("Netty", mapping.map("netty.io"));
        assertEquals("Netty", mapping.map("downloads.netty.io"));
        assertEquals("Netty", mapping.map("x.y.z.netty.io"));

        assertEquals("NotFound", mapping.map("netty.io.x"));
    }

    @Test
    public void testFirstMatchWinsInDeprecatedApi() {
        assertEquals("Netty",
            new DomainNameMapping<String>("NotFound")
                .add("*.netty.io", "Netty")
                .add("downloads.netty.io", "Netty-Downloads")
                .map("downloads.netty.io"));

        assertEquals("Netty-Downloads",
            new DomainNameMapping<String>("NotFound")
                .add("downloads.netty.io", "Netty-Downloads")

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free