private void assertInactiveReuse(ClusterSpec.Type clusterType, boolean expectedReuse) {
        NodeResources r = new NodeResources(20, 40, 100, 4);
        ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east")))
                                                                    .flavors(List.of(new Flavor(r)))
                                                                    .build();
        tester.makeReadyHosts(4, r).activateTenantHosts();

        ApplicationId app1 = ProvisioningTester.applicationId("app1");
        ClusterSpec cluster1 = ClusterSpec.request(clusterType, new ClusterSpec.Id("cluster1")).vespaVersion("7").build();

        tester.activate(app1, cluster1, Capacity.from(new ClusterResources(4, 1, r)));
        tester.activate(app1, cluster1, Capacity.from(new ClusterResources(2, 1, r)));

        // Deactivate any retired nodes - usually done by the RetiredExpirer
        tester.nodeRepository().nodes().setRemovable(tester.getNodes(app1).retired(), false);
        tester.activate(app1, cluster1, Capacity.from(new ClusterResources(2, 1, r)));

        if (expectedReuse) {
            assertEquals(2, tester.getNodes(app1, Node.State.inactive).size());
            tester.activate(app1, cluster1, Capacity.from(new ClusterResources(4, 1, r)));
            assertEquals(0, tester.getNodes(app1, Node.State.inactive).size());
        }
        else {
            assertEquals(0, tester.getNodes(app1, Node.State.inactive).size());
            assertEquals(2, tester.nodeRepository().nodes().list(Node.State.dirty).size());
            tester.move(Node.State.ready, tester.nodeRepository().nodes().list(Node.State.dirty).asList());
            tester.activate(app1, cluster1, Capacity.from(new ClusterResources(4, 1, r)));
        }

    }
Non-exclusive app first, then an exclusive: Should give the same result as above
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/VirtualNodeProvisioningTest.java