Reflection

Sources https://dzone.com/articles/think-twice-before-using-reflection https://www.javacodegeeks.com/2015/09/how-to-use-reflection-effectively.html https://www.baeldung.com/java-reflection

October 8, 2022 · 4 words · Peter Dieleman

Notes on Unit testing using Rest Assured & Junit

Unpacking a List of results https://stackoverflow.com/questions/43850101/rest-assured-json-body-assertion-for-set-of-values-in-list-regardless-of-posit https://stackoverflow.com/questions/68794097/how-to-get-list-of-objects-with-restassured-instead-of-array-of-objects https://stackoverflow.com/questions/15531767/rest-assured-generic-list-deserialization https://stackoverflow.com/questions/49324680/how-to-verify-that-array-contains-object-with-rest-assured https://www.james-willett.com/rest-assured-extract-json-response/ https://devqa.io/parse-json-response-rest-assured/ List<Person> persons = given() .when() .get("/person") .then() .extract() .body() // here's the magic .jsonPath().getList(".", Person.class); Further Notes on Logging ALL asserts (even passing ones) How to output of Asserts (expected, actual) to console, for failing as well as succesfull tests? https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time https://github.com/radarsh/gradle-test-logger-plugin https://mkyong.com/gradle/gradle-display-test-results-in-console/ https://stackoverflow.com/questions/56436541/assertj-log-all-passing-and-failing-assertions https://stackoverflow.com/questions/56436541/assertj-log-all-passing-and-failing-assertions https://github.com/assertj/assertj/issues/1518 https://assertj.github.io/doc/#assertj-core-assertion-description-consumer https://stackoverflow.com/questions/65113051/junit5-assertj-create-log-entry-on-assertion https://stackoverflow.com/questions/28994316/can-you-add-a-custom-message-to-assertj-assertthat https://stackoverflow.com/questions/57334283/is-it-possible-to-log-the-name-and-values-of-fields-being-asserted-along-with-co https://stackoverflow.com/questions/15926005/how-make-junit-print-assertion-results AssertJ Alternatives (maybe these support it?) https://blog.frankel.ch/comparison-assertion-libraries/ Hamcrest Does not change the story....

September 22, 2022 · 91 words · Peter Dieleman

Geography blogs

https://www.howderfamily.com/blog/ https://www.atlasobscura.com/categories/geographic-oddities http://ontology.buffalo.edu/smith/baarle/bizarre_shapes.htm

September 20, 2022 · 3 words · Peter Dieleman

Linux Setup

Linux/KDE fresh install checklist Install homebrew Install Git Change top bar Install fish Set up hotkeys Fix meta+up + meta+down key bindings to mirror windows behaviour Set up ssh agent Ensure sleep is energy efficient Set up task manager, turn off grouping Set up (3rd level?) modifier key for easy typing of German characters Install git lfs Install github cli Install netlify cli Set up keyboard to English US (German, Swedish, Finnish) Troubleshooting Vscode settings sync Writing login information to the keychain failed with error 'GDBus....

August 12, 2022 · 106 words · Peter Dieleman

Spring Data: bi-directional relationships

Should we map both sides? https://stackoverflow.com/questions/30464782/how-to-maintain-bi-directional-relationships-with-spring-data-rest-and-jpa/30474303#30474303 It usually simplifies the matter if you try not to use bi-directional relationship whenever possible and rather fall back to a repository to obtain all the entities that make up the backside of the association. https://thorben-janssen.com/best-practices-many-one-one-many-associations-mappings/ https://twitter.com/odrotbohm/status/603247455094841344 https://stackoverflow.com/questions/48754783/do-i-have-to-set-both-sides-for-a-bidirectional-relationship If Yes - Do we have to manually update both sides? https://stackoverflow.com/questions/7546161/update-bidirectional-manytomany-from-both-sides https://stackoverflow.com/questions/20068742/jpa-updating-bidirectional-association https://hellokoding.com/jpa-one-to-many-relationship-mapping-example-with-spring-boot-maven-and-mysql/ CascadeType.ALL is for propagating the CRUD operations on the parent entity to the child entities....

August 10, 2022 · 133 words · Peter Dieleman

Persisting ArrayList

https://stackoverflow.com/questions/25415738/how-to-persist-arraylist-within-spring-entity-class Need: @ElementCollection & @CollectionTable(name="abc") ? https://thorben-janssen.com/hibernate-tips-elementcollection/ Does this still require a separate table? https://stackoverflow.com/questions/26512916/what-column-type-is-required-when-using-elementcollection-with-jpa https://www.postgresql.org/docs/current/arrays.html https://sajithv.medium.com/spring-jpa-data-with-postgres-array-types-a6cc4be421e2 Hibernate & Arrays From: Vlad Mihalcea " Hibernate ORM does not support ARRAY column types" Also see: https://stackoverflow.com/questions/1647583/how-to-map-a-postgresql-array-with-hibernate Semi-canonical solution Use: https://github.com/vladmihalcea/hibernate-types https://vladmihalcea.com/how-to-map-java-and-sql-arrays-with-jpa-and-hibernate/ PostgreSQL data types https://www.postgresql.org/docs/current/arrays.html And there’s this https://stackoverflow.com/questions/69858533/replacement-for-hibernates-deprecated-type-annotation https://stackoverflow.com/questions/4332467/mapping-array-with-hibernate https://stackoverflow.com/questions/62647125/hibernate-envers-does-not-recognize-custom-types-from-hibernate-types-52

August 3, 2022 · 50 words · Peter Dieleman

Disabling CORS in local development

Problem Access to the XMLHttpRequest at ‘http://localhost:8084’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Frontend side Disabling CORS in https://stackoverflow.com/questions/46337471/how-to-allow-cors-in-react-js https://nabil6391.medium.com/avoid-cors-requests-for-a-react-app-2988e0061c1a https://reactjs.org/docs/cross-origin-errors.html <> Backend side https://howtodoinjava.com/spring-boot2/spring-cors-configuration/ Should we be doing this in prod? https://zetcode.com/springboot/cors/ https://www.baeldung.com/spring-cors https://www.baeldung.com/spring-security-cors-preflight If we use Spring Security in our project, we must take an extra step to make sure it plays well with CORS....

August 2, 2022 · 105 words · Peter Dieleman

BIOS ERROR (bug)

BIOS ERROR (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (2022103730/psargs-330) https://github.com/intel/linux-intel-lts/issues/22 https://bugzilla.kernel.org/show_bug.cgi?id=213023 `The fix was reverted recently in the upstream commit 2ca8e6285250 (which was backported to stable trees, too), hence the problem resurfaced. That said, we came back to square. Fixed again on kernel 5.18.14

August 1, 2022 · 45 words · Peter Dieleman

Paneer Jalfrezi

Recipe 1 From https://www.indianhealthyrecipes.com/paneer-jalfrezi-recipe/ 1 1/4 cup of tomatoes 1 cup of onions 1 green chili 1 1/2 ginger garlic paste 1+ bell pepper sliced 250g paneer 1 teaspoon vinegar 1 teaspoon sugar 2 tablespoons coriander leaves Optional: other veggies (peas) Optional: Cilantro 1/2 teaspoon cumin seeds 1++ teaspoon garam masala 1/2++ teaspoon Kashmiri red chili powder 1/8 teaspoon turmeric 1/3 teaspoon salt Some lime juice Recipe 2 Recipe from: https://pipingpotcurry....

July 30, 2022 · 127 words · Peter Dieleman

Covering Cornering Cases

Defining Unique constraints over multiple columns https://www.baeldung.com/jpa-unique-constraints https://stackoverflow.com/questions/3126769/uniqueconstraint-annotation-in-java

July 29, 2022 · 8 words · Peter Dieleman