shorter person names to make tests easier to read

This commit is contained in:
Michael Hoennig 2022-09-30 13:11:34 +02:00
parent 956ee581c6
commit 16d1372d41
9 changed files with 48 additions and 48 deletions

View File

@ -59,10 +59,10 @@ end; $$;
do language plpgsql $$ do language plpgsql $$
begin begin
call createHsOfficePersonTestData('LEGAL', 'First Impressions GmbH'); call createHsOfficePersonTestData('LEGAL', 'First GmbH');
call createHsOfficePersonTestData('NATURAL', null, 'Smith', 'Peter'); call createHsOfficePersonTestData('NATURAL', null, 'Smith', 'Peter');
call createHsOfficePersonTestData('LEGAL', 'Rockshop e.K.', 'Sandra', 'Miller'); call createHsOfficePersonTestData('LEGAL', 'Second e.K.', 'Sandra', 'Miller');
call createHsOfficePersonTestData('SOLE_REPRESENTATION', 'Ostfriesische Kuhhandel OHG'); call createHsOfficePersonTestData('SOLE_REPRESENTATION', 'Third OHG');
call createHsOfficePersonTestData('JOINT_REPRESENTATION', 'Erben Bessler', 'Mel', 'Bessler'); call createHsOfficePersonTestData('JOINT_REPRESENTATION', 'Erben Bessler', 'Mel', 'Bessler');
call createHsOfficePersonTestData('NATURAL', null, 'Bessler', 'Anita'); call createHsOfficePersonTestData('NATURAL', null, 'Bessler', 'Anita');
call createHsOfficePersonTestData('NATURAL', null, 'Winkler', 'Paul'); call createHsOfficePersonTestData('NATURAL', null, 'Winkler', 'Paul');

View File

@ -63,11 +63,11 @@ end; $$;
do language plpgsql $$ do language plpgsql $$
begin begin
call createHsOfficePartnerTestData('First Impressions GmbH', 'first contact'); call createHsOfficePartnerTestData('First GmbH', 'first contact');
call createHsOfficePartnerTestData('Rockshop e.K.', 'second contact'); call createHsOfficePartnerTestData('Second e.K.', 'second contact');
call createHsOfficePartnerTestData('Ostfriesische Kuhhandel OHG', 'third contact'); call createHsOfficePartnerTestData('Third OHG', 'third contact');
end; end;
$$; $$;
--// --//

View File

@ -71,11 +71,11 @@ end; $$;
do language plpgsql $$ do language plpgsql $$
begin begin
call createHsOfficeRelationshipTestData('First Impressions GmbH', 'Smith', 'SOLE_AGENT', 'first contact'); call createHsOfficeRelationshipTestData('First GmbH', 'Smith', 'SOLE_AGENT', 'first contact');
call createHsOfficeRelationshipTestData('Rockshop e.K.', 'Smith', 'SOLE_AGENT', 'second contact'); call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'SOLE_AGENT', 'second contact');
call createHsOfficeRelationshipTestData('Ostfriesische Kuhhandel OHG', 'Smith', 'SOLE_AGENT', 'third contact'); call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'SOLE_AGENT', 'third contact');
end; end;
$$; $$;
--// --//

View File

@ -77,15 +77,15 @@ class HsOfficePartnerControllerAcceptanceTest {
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
[ [
{ {
"person": { "tradeName": "First Impressions GmbH" }, "person": { "tradeName": "First GmbH" },
"contact": { "label": "first contact" } "contact": { "label": "first contact" }
}, },
{ {
"person": { "tradeName": "Ostfriesische Kuhhandel OHG" }, "person": { "tradeName": "Third OHG" },
"contact": { "label": "third contact" } "contact": { "label": "third contact" }
}, },
{ {
"person": { "tradeName": "Rockshop e.K." }, "person": { "tradeName": "Second e.K." },
"contact": { "label": "second contact" } "contact": { "label": "second contact" }
} }
] ]
@ -102,7 +102,7 @@ class HsOfficePartnerControllerAcceptanceTest {
void globalAdmin_withoutAssumedRole_canAddPartner() { void globalAdmin_withoutAssumedRole_canAddPartner() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0); final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off final var location = RestAssured // @formatter:off
@ -140,7 +140,7 @@ class HsOfficePartnerControllerAcceptanceTest {
void globalAdmin_canNotAddPartner_ifContactDoesNotExist() { void globalAdmin_canNotAddPartner_ifContactDoesNotExist() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6"); final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
final var location = RestAssured // @formatter:off final var location = RestAssured // @formatter:off
@ -214,7 +214,7 @@ class HsOfficePartnerControllerAcceptanceTest {
.contentType("application/json") .contentType("application/json")
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
{ {
"person": { "tradeName": "First Impressions GmbH" }, "person": { "tradeName": "First GmbH" },
"contact": { "label": "first contact" } "contact": { "label": "first contact" }
} }
""")); // @formatter:on """)); // @formatter:on
@ -253,7 +253,7 @@ class HsOfficePartnerControllerAcceptanceTest {
.contentType("application/json") .contentType("application/json")
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
{ {
"person": { "tradeName": "First Impressions GmbH" }, "person": { "tradeName": "First GmbH" },
"contact": { "label": "first contact" } "contact": { "label": "first contact" }
} }
""")); // @formatter:on """)); // @formatter:on
@ -269,7 +269,7 @@ class HsOfficePartnerControllerAcceptanceTest {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenPartner = givenSomeTemporaryPartnerBessler(); final var givenPartner = givenSomeTemporaryPartnerBessler();
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0); final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
final var location = RestAssured // @formatter:off final var location = RestAssured // @formatter:off
@ -303,7 +303,7 @@ class HsOfficePartnerControllerAcceptanceTest {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isPresent().get() assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isPresent().get()
.matches(person -> { .matches(person -> {
assertThat(person.getPerson().getTradeName()).isEqualTo("Ostfriesische Kuhhandel OHG"); assertThat(person.getPerson().getTradeName()).isEqualTo("Third OHG");
assertThat(person.getContact().getLabel()).isEqualTo("forth contact"); assertThat(person.getContact().getLabel()).isEqualTo("forth contact");
assertThat(person.getRegistrationOffice()).isEqualTo("Registergericht Hamburg"); assertThat(person.getRegistrationOffice()).isEqualTo("Registergericht Hamburg");
assertThat(person.getRegistrationNumber()).isEqualTo("222222"); assertThat(person.getRegistrationNumber()).isEqualTo("222222");

View File

@ -71,7 +71,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
// given // given
context("superuser-alex@hostsharing.net"); context("superuser-alex@hostsharing.net");
final var count = partnerRepo.count(); final var count = partnerRepo.count();
final var givenPerson = personRepo.findPersonByOptionalNameLike("First Impressions GmbH").get(0); final var givenPerson = personRepo.findPersonByOptionalNameLike("First GmbH").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0); final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0);
// when // when
@ -150,21 +150,21 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
// then // then
allThesePartnersAreReturned( allThesePartnersAreReturned(
result, result,
"partner(Ostfriesische Kuhhandel OHG, third contact)", "partner(Third OHG, third contact)",
"partner(Rockshop e.K., second contact)", "partner(Second e.K., second contact)",
"partner(First Impressions GmbH, first contact)"); "partner(First GmbH, first contact)");
} }
@Test @Test
public void normalUser_canViewOnlyRelatedPartners() { public void normalUser_canViewOnlyRelatedPartners() {
// given: // given:
context("person-FirstImpressionsGmbH@example.com"); context("person-FirstGmbH@example.com");
// when: // when:
final var result = partnerRepo.findPartnerByOptionalNameLike(null); final var result = partnerRepo.findPartnerByOptionalNameLike(null);
// then: // then:
exactlyThesePartnersAreReturned(result, "partner(First Impressions GmbH, first contact)"); exactlyThesePartnersAreReturned(result, "partner(First GmbH, first contact)");
} }
} }
@ -180,7 +180,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
final var result = partnerRepo.findPartnerByOptionalNameLike("third contact"); final var result = partnerRepo.findPartnerByOptionalNameLike("third contact");
// then // then
exactlyThesePartnersAreReturned(result, "partner(Ostfriesische Kuhhandel OHG, third contact)"); exactlyThesePartnersAreReturned(result, "partner(Third OHG, third contact)");
} }
} }
@ -197,7 +197,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
"hs_office_person#ErbenBesslerMelBessler.admin"); "hs_office_person#ErbenBesslerMelBessler.admin");
assertThatPartnerActuallyInDatabase(givenPartner); assertThatPartnerActuallyInDatabase(givenPartner);
context("superuser-alex@hostsharing.net"); context("superuser-alex@hostsharing.net");
final var givenNewPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische Kuhhandel OHG").get(0); final var givenNewPerson = personRepo.findPersonByOptionalNameLike("Third OHG").get(0);
final var givenNewContact = contactRepo.findContactByOptionalLabelLike("sixth contact").get(0); final var givenNewContact = contactRepo.findContactByOptionalLabelLike("sixth contact").get(0);
// when // when
@ -216,7 +216,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
"global#global.admin"); "global#global.admin");
assertThatPartnerIsVisibleForUserWithRole( assertThatPartnerIsVisibleForUserWithRole(
result.returnedValue(), result.returnedValue(),
"hs_office_person#OstfriesischeKuhhandelOHG.admin"); "hs_office_person#ThirdOHG.admin");
assertThatPartnerIsNotVisibleForUserWithRole( assertThatPartnerIsNotVisibleForUserWithRole(
result.returnedValue(), result.returnedValue(),
"hs_office_person#ErbenBesslerMelBessler.admin"); "hs_office_person#ErbenBesslerMelBessler.admin");

View File

@ -83,19 +83,19 @@ class HsOfficePersonControllerAcceptanceTest {
}, },
{ {
"personType": "LEGAL", "personType": "LEGAL",
"tradeName": "First Impressions GmbH", "tradeName": "First GmbH",
"givenName": null, "givenName": null,
"familyName": null "familyName": null
}, },
{ {
"personType": "SOLE_REPRESENTATION", "personType": "SOLE_REPRESENTATION",
"tradeName": "Ostfriesische Kuhhandel OHG", "tradeName": "Third OHG",
"givenName": null, "givenName": null,
"familyName": null "familyName": null
}, },
{ {
"personType": "LEGAL", "personType": "LEGAL",
"tradeName": "Rockshop e.K.", "tradeName": "Second e.K.",
"givenName": "Miller", "givenName": "Miller",
"familyName": "Sandra" "familyName": "Sandra"
}, },

View File

@ -144,8 +144,8 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
allThesePersonsAreReturned( allThesePersonsAreReturned(
result, result,
"Smith, Peter", "Smith, Peter",
"Rockshop e.K.", "Second e.K.",
"Ostfriesische Kuhhandel OHG", "Third OHG",
"Erben Bessler"); "Erben Bessler");
} }
@ -172,10 +172,10 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
context("superuser-alex@hostsharing.net", null); context("superuser-alex@hostsharing.net", null);
// when // when
final var result = personRepo.findPersonByOptionalNameLike("Rockshop"); final var result = personRepo.findPersonByOptionalNameLike("Second");
// then // then
exactlyThesePersonsAreReturned(result, "Rockshop e.K."); exactlyThesePersonsAreReturned(result, "Second e.K.");
} }
@Test @Test

View File

@ -85,7 +85,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
{ {
"relAnchor": { "relAnchor": {
"personType": "SOLE_REPRESENTATION", "personType": "SOLE_REPRESENTATION",
"tradeName": "Ostfriesische Kuhhandel OHG" "tradeName": "Third OHG"
}, },
"relHolder": { "relHolder": {
"personType": "NATURAL", "personType": "NATURAL",
@ -98,7 +98,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
{ {
"relAnchor": { "relAnchor": {
"personType": "LEGAL", "personType": "LEGAL",
"tradeName": "Rockshop e.K.", "tradeName": "Second e.K.",
"givenName": "Miller", "givenName": "Miller",
"familyName": "Sandra" "familyName": "Sandra"
}, },
@ -113,7 +113,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
{ {
"relAnchor": { "relAnchor": {
"personType": "LEGAL", "personType": "LEGAL",
"tradeName": "First Impressions GmbH" "tradeName": "First GmbH"
}, },
"relHolder": { "relHolder": {
"personType": "NATURAL", "personType": "NATURAL",
@ -138,7 +138,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
void globalAdmin_withoutAssumedRole_canAddRelationship() { void globalAdmin_withoutAssumedRole_canAddRelationship() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0); final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0);
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0); final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
@ -166,7 +166,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.contentType(ContentType.JSON) .contentType(ContentType.JSON)
.body("uuid", isUuidValid()) .body("uuid", isUuidValid())
.body("relType", is("ACCOUNTING_CONTACT")) .body("relType", is("ACCOUNTING_CONTACT"))
.body("relAnchor.tradeName", is("Ostfriesische Kuhhandel OHG")) .body("relAnchor.tradeName", is("Third OHG"))
.body("relHolder.givenName", is("Paul")) .body("relHolder.givenName", is("Paul"))
.body("contact.label", is("forth contact")) .body("contact.label", is("forth contact"))
.header("Location", startsWith("http://localhost")) .header("Location", startsWith("http://localhost"))
@ -215,7 +215,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
void globalAdmin_canNotAddRelationship_ifHolderPersonDoesNotExist() { void globalAdmin_canNotAddRelationship_ifHolderPersonDoesNotExist() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenHolderPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6"); final var givenHolderPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0); final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
@ -248,7 +248,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
void globalAdmin_canNotAddRelationship_ifContactDoesNotExist() { void globalAdmin_canNotAddRelationship_ifContactDoesNotExist() {
context.define("superuser-alex@hostsharing.net"); context.define("superuser-alex@hostsharing.net");
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0); final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0); final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0);
final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6"); final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
@ -298,7 +298,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.contentType("application/json") .contentType("application/json")
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
{ {
"relAnchor": { "tradeName": "First Impressions GmbH" }, "relAnchor": { "tradeName": "First GmbH" },
"relHolder": { "familyName": "Smith" }, "relHolder": { "familyName": "Smith" },
"contact": { "label": "first contact" } "contact": { "label": "first contact" }
} }
@ -339,7 +339,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
.contentType("application/json") .contentType("application/json")
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
{ {
"relAnchor": { "tradeName": "First Impressions GmbH" }, "relAnchor": { "tradeName": "First GmbH" },
"relHolder": { "familyName": "Smith" }, "relHolder": { "familyName": "Smith" },
"contact": { "label": "first contact" } "contact": { "label": "first contact" }
} }

View File

@ -162,15 +162,15 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then // then
allTheseRelationshipsAreReturned( allTheseRelationshipsAreReturned(
result, result,
"rel(relAnchor='First Impressions GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')", "rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')",
"rel(relAnchor='Ostfriesische Kuhhandel OHG', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='third contact')", "rel(relAnchor='Third OHG', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='third contact')",
"rel(relAnchor='Rockshop e.K.', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='second contact')"); "rel(relAnchor='Second e.K.', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='second contact')");
} }
@Test @Test
public void normalUser_canViewRelationshipsOfOwnedPersons() { public void normalUser_canViewRelationshipsOfOwnedPersons() {
// given: // given:
context("person-FirstImpressionsGmbH@example.com"); context("person-FirstGmbH@example.com");
final var person = personRepo.findPersonByOptionalNameLike("First").stream().findFirst().orElseThrow(); final var person = personRepo.findPersonByOptionalNameLike("First").stream().findFirst().orElseThrow();
// when: // when:
@ -179,7 +179,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
// then: // then:
exactlyTheseRelationshipsAreReturned( exactlyTheseRelationshipsAreReturned(
result, result,
"rel(relAnchor='First Impressions GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')"); "rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')");
} }
} }