Skip to content

Instantly share code, notes, and snippets.

View dsmf's full-sized avatar

Matthias Fischer dsmf

  • doubleSlash Net-Business GmbH
View GitHub Profile
@dsmf
dsmf / approval-tests-maven-dependency.xml
Last active October 20, 2023 16:55
Blog - ApprovalTests als Refactoring-Sicherungsnetz
<dependency>
<groupId>com.approvaltests</groupId>
<artifactId>approvaltests</artifactId>
<version>19.0.0</version>
<scope>test</scope>
</dependency>
@dsmf
dsmf / Blogserie_Obsidian.md
Created August 14, 2023 12:19
Blogserie zu Obsidian

Mehr zum Thema Personal Knowledge Management mit Obsidian können Sie hier lesen:

Diese Serie enthält noch keine Artikel

@dsmf
dsmf / TestingExceptionsDemo.java
Last active August 16, 2023 21:11
Blog Testing Exceptions
package examples;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.UUID;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.junit.jupiter.api.Assertions;
@dsmf
dsmf / example-1-result.txt
Last active August 4, 2023 15:49
Blog - Exception Handling - Fehler durch Sprungbefehle in finally verschlucken
i: 0
simulating cleanup
@dsmf
dsmf / 01.java
Last active July 21, 2023 23:45
Blog - Exception Handling - Fehler nicht maskieren durch neue Exception
public class SuppressionDemo {
// ...
public static class BusinessLogic {
// Business-Logik, die mit einer Exception fehlschlagen kann
private void businessLogicThatThrowsAnException() throws IOException {
throw new IOException("exception from main business logic");
}
@dsmf
dsmf / testobject-creation-ex1-1-without-builder.java
Last active July 17, 2023 11:20
Testobject Builder Example 1 BEFORE
final Account account = new Account();
account.setName("mmustermann");
final Person person = new Person();
person.setGivenName("Max");
person.setSurname("Mustermann");
account.setPerson(person);
final Set<Role> roles = new HashSet<>();
describe('phonePatternValidator', () => {
const parameters = [
// valid phone numbers
{value: '07541/123456-12', valid: true},
{value: '+49 (0)7541/123456-12', valid: true},
{value: '0049 7541/123456-12', valid: true},
{value: '0754112345612', valid: true},
{value: '0152-123123', valid: true},
{value: '0157 123123', valid: true},
@dsmf
dsmf / first-file.java
Last active May 26, 2023 11:35
Blog Embed single file from multiline gist
public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello World!");
}
}
@dsmf
dsmf / 1-example-endpoint.java
Last active May 24, 2023 21:46
Spring Boot WithMockUser parametrisiert
@GetMapping(FIND_SOMETHING_URL)
@PreAuthorize("authentication.name == 'admin' or (hasRole('REQUIRED_ROLE_1') and hasRole('REQUIRED_ROLE_2'))")
public ResponseEntity<BaseResponse> findSomething(...) {
...
}