diff options
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java')
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java index 1e258e8febc..b643d3e90d2 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java @@ -9,17 +9,17 @@ import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; import com.yahoo.vespa.hosted.controller.api.integration.organization.OwnershipIssues; import com.yahoo.vespa.hosted.controller.api.integration.organization.User; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.time.Duration; import java.util.List; import java.util.Optional; import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTester.appId; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author jonmv @@ -30,7 +30,7 @@ public class ApplicationOwnershipConfirmerTest { private ApplicationOwnershipConfirmer confirmer; private DeploymentTester tester; - @Before + @BeforeEach public void setup() { tester = new DeploymentTester(); issues = new MockOwnershipIssues(); @@ -38,7 +38,7 @@ public class ApplicationOwnershipConfirmerTest { } @Test - public void testConfirmation() { + void testConfirmation() { Optional<Contact> contact = Optional.of(tester.controllerTester().serviceRegistry().contactRetrieverMock().contact()); var app = tester.newDeploymentContext(); tester.controller().tenants().lockOrThrow(appId.tenant(), LockedTenant.Athenz.class, tenant -> @@ -48,55 +48,55 @@ public class ApplicationOwnershipConfirmerTest { var appWithoutContact = tester.newDeploymentContext("other", "application", "default"); appWithoutContact.submit().deploy(); - assertFalse("No issue is initially stored for a new application.", app.application().ownershipIssueId().isPresent()); - assertFalse("No issue is initially stored for a new application.", appWithoutContact.application().ownershipIssueId().isPresent()); - assertFalse("No escalation has been attempted for a new application", issues.escalated); + assertFalse(app.application().ownershipIssueId().isPresent(), "No issue is initially stored for a new application."); + assertFalse(appWithoutContact.application().ownershipIssueId().isPresent(), "No issue is initially stored for a new application."); + assertFalse(issues.escalated, "No escalation has been attempted for a new application"); // Set response from the issue mock, which will be obtained by the maintainer on issue filing. Optional<IssueId> issueId = Optional.of(IssueId.from("1")); issues.response = issueId; confirmer.maintain(); - assertFalse("No issue is stored for an application newer than 3 months.", app.application().ownershipIssueId().isPresent()); - assertFalse("No issue is stored for an application newer than 3 months.", appWithoutContact.application().ownershipIssueId().isPresent()); + assertFalse(app.application().ownershipIssueId().isPresent(), "No issue is stored for an application newer than 3 months."); + assertFalse(appWithoutContact.application().ownershipIssueId().isPresent(), "No issue is stored for an application newer than 3 months."); tester.clock().advance(Duration.ofDays(91)); confirmer.maintain(); - assertEquals("Confirmation issue has been filed for application with contact.", issueId, app.application().ownershipIssueId()); - assertTrue("The confirmation issue response has been ensured.", issues.escalated); - assertEquals("No confirmation issue has been filed for application without contact.", Optional.empty(), appWithoutContact.application().ownershipIssueId()); + assertEquals(issueId, app.application().ownershipIssueId(), "Confirmation issue has been filed for application with contact."); + assertTrue(issues.escalated, "The confirmation issue response has been ensured."); + assertEquals(Optional.empty(), appWithoutContact.application().ownershipIssueId(), "No confirmation issue has been filed for application without contact."); // No new issue is created, so return empty now. issues.response = Optional.empty(); confirmer.maintain(); - assertEquals("Confirmation issue reference is not updated when no issue id is returned.", issueId, app.application().ownershipIssueId()); + assertEquals(issueId, app.application().ownershipIssueId(), "Confirmation issue reference is not updated when no issue id is returned."); // Time has passed, and a new confirmation issue is in order for the property which is still in production. Optional<IssueId> issueId2 = Optional.of(IssueId.from("2")); issues.response = issueId2; confirmer.maintain(); - assertEquals("A new confirmation issue id is stored when something is returned to the maintainer.", issueId2, app.application().ownershipIssueId()); + assertEquals(issueId2, app.application().ownershipIssueId(), "A new confirmation issue id is stored when something is returned to the maintainer."); - assertFalse("No owner is stored for application", app.application().owner().isPresent()); + assertFalse(app.application().owner().isPresent(), "No owner is stored for application"); issues.owner = Optional.of(User.from("username")); confirmer.maintain(); - assertEquals("Owner has been added to application", app.application().owner().get().username(), "username"); + assertEquals(app.application().owner().get().username(), "username", "Owner has been added to application"); // The app deletes all production deployments — see that the issue is forgotten. - assertEquals("Confirmation issue for application is still open.", issueId2, app.application().ownershipIssueId()); + assertEquals(issueId2, app.application().ownershipIssueId(), "Confirmation issue for application is still open."); app.application().productionDeployments().values().stream().flatMap(List::stream) - .forEach(deployment -> tester.controller().applications().deactivate(app.instanceId(), deployment.zone())); - assertTrue("No production deployments are listed for user.", app.application().require(InstanceName.defaultName()).productionDeployments().isEmpty()); + .forEach(deployment -> tester.controller().applications().deactivate(app.instanceId(), deployment.zone())); + assertTrue(app.application().require(InstanceName.defaultName()).productionDeployments().isEmpty(), "No production deployments are listed for user."); confirmer.maintain(); // Time has passed, and a new confirmation issue is in order for the property which is still in production. issues.response = Optional.of(IssueId.from("3")); confirmer.maintain(); - assertEquals("Confirmation issue for application without production deployments has not been filed.", issueId2, app.application().ownershipIssueId()); + assertEquals(issueId2, app.application().ownershipIssueId(), "Confirmation issue for application without production deployments has not been filed."); } private static class MockOwnershipIssues implements OwnershipIssues { |