add defaultPrefix to HsOfficeDebitorEntity.toString()
This commit is contained in:
parent
90508df42d
commit
5162aa0606
@ -25,11 +25,14 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
|||||||
@DisplayName("Debitor")
|
@DisplayName("Debitor")
|
||||||
public class HsOfficeDebitorEntity implements Stringifyable {
|
public class HsOfficeDebitorEntity implements Stringifyable {
|
||||||
|
|
||||||
|
// TODO: I would rather like to generate something matching this example:
|
||||||
|
// debitor(1234500: Test AG, tes)
|
||||||
|
// maybe remove withSepararator (always use ', ') and add withBusinessIdProp (with ': ' afterwards)?
|
||||||
private static Stringify<HsOfficeDebitorEntity> stringify =
|
private static Stringify<HsOfficeDebitorEntity> stringify =
|
||||||
stringify(HsOfficeDebitorEntity.class, "debitor")
|
stringify(HsOfficeDebitorEntity.class, "debitor")
|
||||||
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
||||||
.withProp(HsOfficeDebitorEntity::getPartner)
|
.withProp(HsOfficeDebitorEntity::getPartner)
|
||||||
// TODO: add defaultPrefix?
|
.withProp(HsOfficeDebitorEntity::getDefaultPrefix)
|
||||||
.withSeparator(": ")
|
.withSeparator(": ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
|
@ -22,11 +22,12 @@ class HsOfficeDebitorEntityUnitTest {
|
|||||||
.debitorNumberPrefix(12345)
|
.debitorNumberPrefix(12345)
|
||||||
.build())
|
.build())
|
||||||
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
||||||
|
.defaultPrefix("som")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final var result = given.toString();
|
final var result = given.toString();
|
||||||
|
|
||||||
assertThat(result).isEqualTo("debitor(1234567: some trade name)");
|
assertThat(result).isEqualTo("debitor(1234567: some trade name: som)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -215,9 +215,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
// then
|
// then
|
||||||
allTheseDebitorsAreReturned(
|
allTheseDebitorsAreReturned(
|
||||||
result,
|
result,
|
||||||
"debitor(1000111: First GmbH)",
|
"debitor(1000111: First GmbH: fir)",
|
||||||
"debitor(1000212: Second e.K.)",
|
"debitor(1000212: Second e.K.: sec)",
|
||||||
"debitor(1000313: Third OHG)");
|
"debitor(1000313: Third OHG: thi)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ -234,7 +234,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByOptionalNameLike(null);
|
final var result = debitorRepo.findDebitorByOptionalNameLike(null);
|
||||||
|
|
||||||
// then:
|
// then:
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000111: First GmbH)", "debitor(1000120: First GmbH)");
|
exactlyTheseDebitorsAreReturned(result,
|
||||||
|
"debitor(1000111: First GmbH: fir)",
|
||||||
|
"debitor(1000120: First GmbH: fif)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -262,8 +264,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByDebitorNumber(1000313);
|
final var result = debitorRepo.findDebitorByDebitorNumber(1000313);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)", "debitor(1000413: Fourth e.G.)");
|
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG: thi)");
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +280,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
final var result = debitorRepo.findDebitorByOptionalNameLike("third contact");
|
final var result = debitorRepo.findDebitorByOptionalNameLike("third contact");
|
||||||
|
|
||||||
// then
|
// then
|
||||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)");
|
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG: thi)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* which reads CSV files from the file system.
|
* which reads CSV files from the file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Disabled
|
||||||
@DataJpaTest
|
@DataJpaTest
|
||||||
@Import({ Context.class, JpaAttempt.class })
|
@Import({ Context.class, JpaAttempt.class })
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
@ -105,9 +106,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
assertThat(contacts.toString()).isEqualTo("{}");
|
assertThat(contacts.toString()).isEqualTo("{}");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: null, null),
|
7=debitor(1000700: null, null: mih),
|
||||||
10=debitor(1001000: null, null),
|
10=debitor(1001000: null, null: xyz),
|
||||||
12=debitor(1101200: null, null)}
|
12=debitor(1101200: null, null: xxx)}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
@ -153,9 +154,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
""");
|
""");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: Mellies, Michael),
|
7=debitor(1000700: Mellies, Michael: mih),
|
||||||
10=debitor(1001000: JM e.K.),
|
10=debitor(1001000: JM e.K.: xyz),
|
||||||
12=debitor(1101200: Test PS)
|
12=debitor(1101200: Test PS: xxx)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
@ -267,7 +268,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
|
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
|
||||||
updateLegacyIds(coopShares, "hs_office_coopassetstransaction_legacy_id", "member_asset_id");
|
updateLegacyIds(coopShares, "hs_office_coopassetstransaction_legacy_id", "member_asset_id");
|
||||||
|
|
||||||
em.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <E extends HasUuid> void updateLegacyIds(Map<Integer, E> entities, final String legacyIdTable, final String legacyIdColumn) {
|
private <E extends HasUuid> void updateLegacyIds(Map<Integer, E> entities, final String legacyIdTable, final String legacyIdColumn) {
|
||||||
@ -321,7 +321,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
|
|
||||||
final var debitor = HsOfficeDebitorEntity.builder()
|
final var debitor = HsOfficeDebitorEntity.builder()
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.debitorNumberSuffix((byte)0)
|
.debitorNumberSuffix((byte) 0)
|
||||||
.defaultPrefix(rec.getString("member_code").replace("hsh00-", ""))
|
.defaultPrefix(rec.getString("member_code").replace("hsh00-", ""))
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.billingContact(partner.getContact())
|
.billingContact(partner.getContact())
|
||||||
|
@ -376,7 +376,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
|||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH)");
|
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH: fir)");
|
||||||
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
||||||
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z - patched");
|
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z - patched");
|
||||||
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
||||||
@ -417,7 +417,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
|||||||
// finally, the sepaMandate is actually updated
|
// finally, the sepaMandate is actually updated
|
||||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||||
.matches(mandate -> {
|
.matches(mandate -> {
|
||||||
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH)");
|
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(1000111: First GmbH: fir)");
|
||||||
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
||||||
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z");
|
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z");
|
||||||
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2023-01-01)");
|
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2023-01-01)");
|
||||||
|
Loading…
Reference in New Issue
Block a user