db-migration #10
@ -25,11 +25,14 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
||||
@DisplayName("Debitor")
|
||||
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 =
|
||||
stringify(HsOfficeDebitorEntity.class, "debitor")
|
||||
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
||||
.withProp(HsOfficeDebitorEntity::getPartner)
|
||||
// TODO: add defaultPrefix?
|
||||
.withProp(HsOfficeDebitorEntity::getDefaultPrefix)
|
||||
.withSeparator(": ")
|
||||
.quotedValues(false);
|
||||
|
||||
|
@ -22,11 +22,12 @@ class HsOfficeDebitorEntityUnitTest {
|
||||
.debitorNumberPrefix(12345)
|
||||
.build())
|
||||
.billingContact(HsOfficeContactEntity.builder().label("some label").build())
|
||||
.defaultPrefix("som")
|
||||
.build();
|
||||
|
||||
final var result = given.toString();
|
||||
|
||||
assertThat(result).isEqualTo("debitor(1234567: some trade name)");
|
||||
assertThat(result).isEqualTo("debitor(1234567: some trade name: som)");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -215,9 +215,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then
|
||||
allTheseDebitorsAreReturned(
|
||||
result,
|
||||
"debitor(1000111: First GmbH)",
|
||||
"debitor(1000212: Second e.K.)",
|
||||
"debitor(1000313: Third OHG)");
|
||||
"debitor(1000111: First GmbH: fir)",
|
||||
"debitor(1000212: Second e.K.: sec)",
|
||||
"debitor(1000313: Third OHG: thi)");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -234,7 +234,9 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final var result = debitorRepo.findDebitorByOptionalNameLike(null);
|
||||
|
||||
// then:
|
||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000111: First GmbH)", "debitor(1000120: First GmbH)");
|
||||
exactlyTheseDebitorsAreReturned(result,
|
||||
"debitor(1000111: First GmbH: fir)",
|
||||
"debitor(1000120: First GmbH: fif)");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -262,8 +264,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final var result = debitorRepo.findDebitorByDebitorNumber(1000313);
|
||||
|
||||
// then
|
||||
// exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)", "debitor(1000413: Fourth e.G.)");
|
||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG)");
|
||||
exactlyTheseDebitorsAreReturned(result, "debitor(1000313: Third OHG: thi)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,7 +280,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final var result = debitorRepo.findDebitorByOptionalNameLike("third contact");
|
||||
|
||||
// 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.
|
||||
*/
|
||||
|
||||
@Disabled
|
||||
@DataJpaTest
|
||||
@Import({ Context.class, JpaAttempt.class })
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
@ -105,9 +106,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
assertThat(contacts.toString()).isEqualTo("{}");
|
||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
7=debitor(1000700: null, null),
|
||||
10=debitor(1001000: null, null),
|
||||
12=debitor(1101200: null, null)}
|
||||
7=debitor(1000700: null, null: mih),
|
||||
10=debitor(1001000: null, null: xyz),
|
||||
12=debitor(1101200: null, null: xxx)}
|
||||
""");
|
||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
@ -153,9 +154,9 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
""");
|
||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
7=debitor(1000700: Mellies, Michael),
|
||||
10=debitor(1001000: JM e.K.),
|
||||
12=debitor(1101200: Test PS)
|
||||
7=debitor(1000700: Mellies, Michael: mih),
|
||||
10=debitor(1001000: JM e.K.: xyz),
|
||||
12=debitor(1101200: Test PS: xxx)
|
||||
}
|
||||
""");
|
||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||
@ -267,7 +268,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
|
||||
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) {
|
||||
|
@ -376,7 +376,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||
.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.getReference()).isEqualTo("temp ref CAT Z - patched");
|
||||
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
||||
@ -417,7 +417,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
||||
// finally, the sepaMandate is actually updated
|
||||
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||
.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.getReference()).isEqualTo("temp ref CAT Z");
|
||||
assertThat(mandate.getValidity().asString()).isEqualTo("[2022-11-01,2023-01-01)");
|
||||
|
Loading…
Reference in New Issue
Block a user