@Test
    void testNonMandatoryUnderspecifiedUserProfileSetInRequest() {
        Fixture1 fixture = new Fixture1();

        QueryProfile test = new QueryProfile("test");
        test.setType(fixture.type);
        fixture.registry.register(test);

        QueryProfile myUser = new QueryProfile("user");
        myUser.setType(fixture.user);
        myUser.set("myUserInteger", 1, fixture.registry);
        myUser.set("myUserString", "userValue", fixture.registry);
        test.set("myUserQueryProfile", myUser, fixture.registry);
        fixture.registry.register(myUser);

        QueryProfile otherUser = new QueryProfile("otherUser");
        otherUser.setType(fixture.user);
        otherUser.set("myUserInteger", 2, fixture.registry);
        fixture.registry.register(otherUser);

        CompiledQueryProfileRegistry cRegistry = fixture.registry.compile();

        // Fully specified request
        assertError(null, new Query(HttpRequest.createTestRequest("?myString=aString", Method.GET), cRegistry.getComponent("test")));

        // Underspecified because an underspecified profile is added
        assertError("Incomplete query: Parameter 'myQueryProfile.myUserString' is mandatory in query profile 'test' of type 'testtype' but is not set",
                new Query(HttpRequest.createTestRequest("?myString=aString&myQueryProfile=otherUser", Method.GET), cRegistry.getComponent("test")));

        // Back to fully specified
        assertError(null, new Query(HttpRequest.createTestRequest("?myString=aString&myQueryProfile=otherUser&myQueryProfile.myUserString=userString", Method.GET), cRegistry.getComponent("test")));
    }
Here, a partially specified query profile is added to a non-mandatory field, making the request underspecified
container-search/src/test/java/com/yahoo/search/query/profile/types/test/MandatoryTestCase.java