diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java index 3226900e..57ceef0a 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java @@ -4,6 +4,7 @@ import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateSelfDebitorForPartner; import net.hostsharing.hsadminng.hs.office.usecases.membership.CreateMembership; import net.hostsharing.hsadminng.hs.office.usecases.partner.CreatePartner; +import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteDebitor; import net.hostsharing.hsadminng.hs.office.usecases.partner.DeletePartner; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.MethodOrderer; @@ -43,7 +44,7 @@ class HsOfficeUseCasesTest extends UseCaseTest { } @Test - @Order(2000) + @Order(2010) void shouldCreateSelfDebitorForPartner() { new CreateSelfDebitorForPartner(this, "Debitor: Test AG - main debitor") .given("partnerPersonUuid", "%{Person: Test AG}") @@ -60,6 +61,15 @@ class HsOfficeUseCasesTest extends UseCaseTest { .keep(); } + @Test + @Order(2020) + void shouldDeleteDebitor() { + new DeleteDebitor(this) + .given("partnerNumber", 31020) + .given("debitorSuffix", "01") + .doRun(); + } + @Test @Order(3000) void shouldCreateMembershipForPartner() { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java new file mode 100644 index 00000000..c006ef77 --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java @@ -0,0 +1,31 @@ +package net.hostsharing.hsadminng.hs.office.usecases.debitor; + +import net.hostsharing.hsadminng.hs.office.usecases.UseCase; +import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import org.springframework.http.HttpStatus; + +public class DeleteDebitor extends UseCase { + + public DeleteDebitor(final UseCaseTest testSuite) { + super(testSuite); + + requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite, alias) + .given("partnerPersonUuid", "%{Person: Test AG}") + .given("billingContactCaption", "Test AG - billing department") + .given("billingContactEmailAddress", "billing@test-ag.example.org") + .given("debitorNumberSuffix", "%{debitorSuffix}") + .given("billable", true) + .given("vatId", "VAT123456") + .given("vatCountryCode", "DE") + .given("vatBusiness", true) + .given("vatReverseCharge", false) + .given("defaultPrefix", "tsx")); + } + + @Override + protected HttpResponse run() { + httpDelete("/api/hs/office/debitors/" + uuid("Debitor: Test AG - delete debitor")) + .expecting(HttpStatus.NO_CONTENT); + return null; + } +}