@Test
    void testTensorRankFeatureSetProgrammaticallyWithWrongType() {
        Query query = new Query.Builder()
                .setSchemaInfo(createSchemaInfo())
                .setQueryProfile(createQueryProfile()) // Use the instantiation path with query profiles
                .setRequest(HttpRequest.createTestRequest("?" +
                        "&ranking=commonProfile",
                        com.yahoo.jdisc.http.HttpRequest.Method.GET))
                .build();

        String tensorString = "tensor(x[3]):[0.1, 0.2, 0.3]";
        try {
            query.getRanking().getFeatures().put("query(myTensor1)", Tensor.from(tensorString));
            fail("Expected exception");
        }
        catch (IllegalArgumentException e) {
            assertEquals("Could not set 'ranking.features.query(myTensor1)' to 'tensor(x[3]):[0.1, 0.2, 0.3]': " +
                    "This input is declared in rank profile 'commonProfile' as tensor(a{},b{})",
                    Exceptions.toMessageString(e));
        }
        try {
            query.properties().set("ranking.features.query(myTensor1)", Tensor.from(tensorString));
            fail("Expected exception");
        }
        catch (IllegalArgumentException e) {
            assertEquals("Could not set 'ranking.features.query(myTensor1)' to 'tensor(x[3]):[0.1, 0.2, 0.3]': " +
                    "Require a tensor of type tensor(a{},b{})",
                    Exceptions.toMessageString(e));
        }
    }
Tests queries towards rank profiles using input declarations.

@author bratseth
container-search/src/test/java/com/yahoo/search/query/RankProfileInputTest.java