feature/use-case-acceptance-tests #116

Merged
hsh-michaelhoennig merged 49 commits from feature/use-case-acceptance-tests into master 2024-10-30 11:40:46 +01:00
2 changed files with 42 additions and 1 deletions
Showing only changes of commit d525763fd9 - Show all commits

View File

@ -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.debitor.CreateSelfDebitorForPartner;
import net.hostsharing.hsadminng.hs.office.usecases.membership.CreateMembership; 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.partner.CreatePartner;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteDebitor;
import net.hostsharing.hsadminng.hs.office.usecases.partner.DeletePartner; import net.hostsharing.hsadminng.hs.office.usecases.partner.DeletePartner;
import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.MethodOrderer;
@ -43,7 +44,7 @@ class HsOfficeUseCasesTest extends UseCaseTest {
} }
@Test @Test
@Order(2000) @Order(2010)
void shouldCreateSelfDebitorForPartner() { void shouldCreateSelfDebitorForPartner() {
new CreateSelfDebitorForPartner(this, "Debitor: Test AG - main debitor") new CreateSelfDebitorForPartner(this, "Debitor: Test AG - main debitor")
.given("partnerPersonUuid", "%{Person: Test AG}") .given("partnerPersonUuid", "%{Person: Test AG}")
@ -60,6 +61,15 @@ class HsOfficeUseCasesTest extends UseCaseTest {
.keep(); .keep();
} }
@Test
@Order(2020)
void shouldDeleteDebitor() {
new DeleteDebitor(this)
.given("partnerNumber", 31020)
.given("debitorSuffix", "01")
.doRun();
}
@Test @Test
@Order(3000) @Order(3000)
void shouldCreateMembershipForPartner() { void shouldCreateMembershipForPartner() {

View File

@ -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<DeleteDebitor> {
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;
}
}