public void assertLargeConstant(String constantName, VespaModel model, Optional<Long> expectedSize) {
        try {
            Path constantApplicationPackagePath = Path.fromString("models.generated/" + modelName + "/constants").append(constantName + ".tbf");
            var constant = model.rankProfileList().constants().asMap().get(constantName);
            assertNotNull(constant);
            assertEquals(constantName, constant.getName());
            assertTrue(constant.getFileName().endsWith(constantApplicationPackagePath.toString()));

            assertTrue(model.fileReferences().contains(new FileReference(constant.getFileName())));

            if (expectedSize.isPresent()) {
                Path constantPath = applicationDir.append(constantApplicationPackagePath);
                assertTrue(constantPath.toFile().exists(),
                           "Constant file '" + constantPath + "' has been written");
                Tensor deserializedConstant = TypedBinaryFormat.decode(Optional.empty(),
                                                                       GrowableByteBuffer.wrap(IOUtils.readFileBytes(constantPath.toFile())));
                assertEquals(expectedSize.get().longValue(), deserializedConstant.size());
            }
        }
        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
Verifies that the constant with the given name exists, and - only if an expected size is given -
that the content of the constant is available and has the expected size.
config-model/src/test/java/com/yahoo/vespa/model/ml/ImportedModelTester.java