I had a problem in my unit test because I used TestPropertyValues like this:

TestPropertyValues.of("tempo.base-url",
                              "http://localhost:" + wireMockServer.port() + "/core/3/")
                          .applyTo(applicationContext);

The correct usage is to provide the key and the value in a single String like this:

TestPropertyValues.of("tempo.base-url=http://localhost:" + wireMockServer.port() + "/core/3/")
                          .applyTo(applicationContext);

I was confused with the Map.of() factory methods from Java 9. I wonder if we could support something like that?

Maybe this:

TestPropertyValues.of(Map.of("key1", "value1",
                             "key2", "value2"))
                          .applyTo(applicationContext);

or (using the inner Pair class):

TestPropertyValues.of(Pair.of("key1", "value1"),
                      Pair.of("key2", "value2"))
                          .applyTo(applicationContext);

Comment From: philwebb

I think the Map variant would work best.