Skip to content

Instantly share code, notes, and snippets.

View thombergs's full-sized avatar

Tom Hombergs thombergs

View GitHub Profile
@thombergs
thombergs / build.gradle
Created January 6, 2023 07:55
Jooq + Flyway Config
plugins {
id 'org.flywaydb.flyway'
id 'nu.studer.jooq'
id 'com.avast.gradle.docker-compose'
}
configurations {
flywayMigration
}
@thombergs
thombergs / charts.js
Created August 26, 2020 02:01
Creating a library with multiple Vue components
import TimeSeriesChart from "../components/time-series-chart/TimeSeriesChart.vue";
// import additional components here
export {
TimeSeriesChart
// add additional components here
};
@thombergs
thombergs / AccountPersistenceAdapter.java
Created September 26, 2019 13:51
AccountPersistenceAdapter
@RequiredArgsConstructor
@Component
class AccountPersistenceAdapter implements
LoadAccountPort,
UpdateAccountStatePort {
private final AccountRepository accountRepository;
private final ActivityRepository activityRepository;
private final AccountMapper accountMapper;
@thombergs
thombergs / AccountPersistenceAdapter.java
Created September 26, 2019 07:37
AccountPersistenceAdapter.java
@RequiredArgsConstructor
@Component
class AccountPersistenceAdapter implements
LoadAccountPort,
UpdateAccountStatePort {
private final AccountRepository accountRepository;
private final ActivityRepository activityRepository;
private final AccountMapper accountMapper;
@thombergs
thombergs / Account.java
Last active September 26, 2019 07:26
Account.java
package buckpal.domain;
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Account {
@Getter private final AccountId id;
@Getter private final ActivityWindow activityWindow;
private final Money baselineBalance;
public static Account withoutId(
public class ConnectionCheckingTest {
private ConnectionChecker connectionChecker =
new ConnectionChecker("http://my.integration.system");
@Test
public void testOnlyWhenConnected() {
assumeTrue(connectionChecker.connect());
... // your test steps
}
@AssumeConnection(uri = "http://my.integration.system")
public class ConnectionCheckingJunit5Test {
@Test
public void testOnlyWhenConnected() {
...
}
}
public class ConnectionCheckingJunit4Test {
@ClassRule
public static AssumingConnection assumingConnection =
new AssumingConnection(new ConnectionChecker("http://my.integration.system"));
@Test
public void testOnlyWhenConnected() {
...
}
public class ConnectionChecker {
private String uri;
public ConnectionChecker(String uri){
this.uri = uri;
}
public boolean connect() {
... // try to connect to the uri
}
public class AssumingConnection implements TestRule {
private ConnectionChecker checker;
public AssumingConnection(ConnectionChecker checker) {
this.checker = checker;
}
@Override
public Statement apply(Statement base, Description description) {