mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Automatically refactor some exception testing to use new JUnit rules
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=176550995
This commit is contained in:
parent
f041b1bac0
commit
c7484b25e0
13 changed files with 199 additions and 194 deletions
|
@ -27,8 +27,8 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
|||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
|
@ -254,17 +254,18 @@ public class UpdateApplicationStatusCommandTest
|
|||
.setApplicationStatus(ALLOCATED)
|
||||
.build());
|
||||
|
||||
try {
|
||||
runCommandForced("--ids=2-Q9JYB4C", "--msg=\"Application rejected\"", "--status=REJECTED");
|
||||
fail("Expected IllegalStateException \"Domain application has final status ALLOCATED\"");
|
||||
} catch (IllegalStateException e) {
|
||||
assertThat(e.getMessage()).contains("Domain application has final status ALLOCATED");
|
||||
assertAboutApplications().that(ofy().load().entity(domainApplication).now())
|
||||
.hasApplicationStatus(ALLOCATED);
|
||||
assertThat(getPollMessageCount()).isEqualTo(0);
|
||||
assertAboutHistoryEntries().that(loadLastHistoryEntry())
|
||||
.hasType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE);
|
||||
}
|
||||
IllegalStateException e =
|
||||
expectThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--ids=2-Q9JYB4C", "--msg=\"Application rejected\"", "--status=REJECTED"));
|
||||
assertThat(e).hasMessageThat().contains("Domain application has final status ALLOCATED");
|
||||
assertAboutApplications().that(ofy().load().entity(domainApplication).now())
|
||||
.hasApplicationStatus(ALLOCATED);
|
||||
assertThat(getPollMessageCount()).isEqualTo(0);
|
||||
assertAboutHistoryEntries().that(loadLastHistoryEntry())
|
||||
.hasType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue