Compare commits

..

No commits in common. "4babea24a1bde04d35425f855fa27ee9b48448bf" and "a1e04508ed480d3b5ea18b42857b53ab38333dfa" have entirely different histories.

5 changed files with 2 additions and 146 deletions

View File

@ -1,11 +1,9 @@
package net.hostsharing.hsadminng.hs.office.usecases;
import net.hostsharing.hsadminng.HsadminNgApplication;
import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateExternalDebitorForPartner;
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;
@ -45,7 +43,7 @@ class HsOfficeUseCasesTest extends UseCaseTest {
}
@Test
@Order(2010)
@Order(2000)
void shouldCreateSelfDebitorForPartner() {
new CreateSelfDebitorForPartner(this, "Debitor: Test AG - main debitor")
.given("partnerPersonUuid", "%{Person: Test AG}")
@ -62,33 +60,6 @@ class HsOfficeUseCasesTest extends UseCaseTest {
.keep();
}
@Test
@Order(2011)
void shouldCreateExternalDebitorForPartner() {
new CreateExternalDebitorForPartner(this, "Debitor: Billing GmbH")
.given("partnerPersonUuid", "%{Person: Test AG}")
.given("billingContactCaption", "Billing GmbH - billing department")
.given("billingContactEmailAddress", "billing@test-ag.example.org")
.given("debitorNumberSuffix", "01")
.given("billable", true)
.given("vatId", "VAT123456")
.given("vatCountryCode", "DE")
.given("vatBusiness", true)
.given("vatReverseCharge", false)
.given("defaultPrefix", "tsx")
.doRun()
.keep();
}
@Test
@Order(2020)
void shouldDeleteDebitor() {
new DeleteDebitor(this)
.given("partnerNumber", 31020)
.given("debitorSuffix", "02")
.doRun();
}
@Test
@Order(3000)
void shouldCreateMembershipForPartner() {

View File

@ -9,7 +9,6 @@ import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.web.server.LocalServerPort;
@ -68,8 +67,7 @@ public abstract class UseCaseTest extends ContextBasedTest {
);
final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow();
final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow();
markdownFile = new PrintWriter(new FileWriter( testMethodOrder + "-" + testMethodName + ".md"));
markdownFile = new PrintWriter(new FileWriter(testMethodName + ".md"));
log("## Testcase " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2"));
currentTestInfo = testInfo; // FIXME: remove?
}

View File

@ -1,57 +0,0 @@
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 net.hostsharing.hsadminng.hs.office.usecases.person.CreatePerson;
import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED;
public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebitorForPartner> {
public CreateExternalDebitorForPartner(final UseCaseTest testSuite, final String resultAlias) {
super(testSuite, resultAlias);
requires("Person: Test AG");
requires("Person: Billing GmbH", alias -> new CreatePerson(testSuite, alias)
.given("personType", "LEGAL_PERSON")
.given("tradeName", "Billing GmbH")
);
}
@Override
protected HttpResponse run() {
keep("Contact: Billing GmbH - Test AG billing", () ->
httpPost("/api/hs/office/contacts", usingJsonBody("""
{
"caption": "Billing GmbH, billing for Test AG",
"emailAddresses": {
"main": "test-ag@billing-GmbH.example.com"
}
}
"""))
.expecting(CREATED).expecting(JSON)
);
return httpPost("/api/hs/office/debitors", usingJsonBody("""
{
"debitorRel": {
"type": "DEBITOR", // FIXME: should be defaulted to DEBITOR
"anchorUuid": ${partnerPersonUuid},
"holderUuid": ${Person: Billing GmbH},
"contactUuid": ${Contact: Billing GmbH - Test AG billing}
},
"debitorNumberSuffix": ${debitorNumberSuffix},
"billable": ${billable},
"vatId": ${vatId},
"vatCountryCode": ${vatCountryCode},
"vatBusiness": ${vatBusiness},
"vatReverseCharge": ${vatReverseCharge},
"refundBankAccountUuid": ${BankAccount: Test AG - refund bank account},
"defaultPrefix": ${defaultPrefix}
}
"""))
.expecting(CREATED).expecting(JSON);
}
}

View File

@ -1,31 +0,0 @@
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", "tsy"));
}
@Override
protected HttpResponse run() {
httpDelete("/api/hs/office/debitors/" + uuid("Debitor: Test AG - delete debitor"))
.expecting(HttpStatus.NO_CONTENT);
return null;
}
}

View File

@ -1,25 +0,0 @@
package net.hostsharing.hsadminng.hs.office.usecases.person;
import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.usecases.UseCase;
import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest;
import org.springframework.http.HttpStatus;
public class CreatePerson extends UseCase<CreatePerson> {
public CreatePerson(final UseCaseTest testSuite, final String resultAlias) {
super(testSuite, resultAlias);
}
@Override
protected HttpResponse run() {
return httpPost("/api/hs/office/persons", usingJsonBody("""
{
"personType": ${personType},
"tradeName": ${tradeName}
}
"""))
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON);
}
}