@Test
    void verifyThatUnextractedFieldsArePresent() {
        UserAgentAnalyzer uaa = UserAgentAnalyzer
            .newBuilder()
            .immediateInitialization()
            .withField(DEVICE_BRAND)
            .withField(AGENT_INFORMATION_URL)
            .withField(AGENT_INFORMATION_EMAIL)
            .withField(DEVICE_CLASS)
            .withField(AGENT_NAME)
            .build();
        UserAgent result = uaa.parse("Mozilla/5.0 (SM-123) Niels Basjes/42");
        Map<String, String> resultMap = result.toMap();
        // As requested: DeviceBrand
        assertEquals("Samsung", resultMap.get(DEVICE_BRAND));
        assertEquals("Unknown", resultMap.get(AGENT_INFORMATION_URL));
        assertEquals("Unknown", resultMap.get(AGENT_INFORMATION_EMAIL));
        assertEquals("Unknown", resultMap.get(DEVICE_CLASS));
        assertEquals("Niels Basjes", resultMap.get(AGENT_NAME));

        // And fields that are not implicitly calculated and not asked for are absent
        assertNull(resultMap.get(OPERATING_SYSTEM_CLASS));
    }
If a field has never been extracted yet it must still be present.
analyzer/src/test/java/nl/basjes/parse/useragent/TestUseragent.java