DBConfig extends Config { @Override protected void validate() { if (url == null) throw new Error("db url must be configured, name=" + name); if (!entityAdded) throw new Error("db is configured but no repository/view added, please remove unnecessary config, name=" + name); }  void url(String url); void user(String user); void password(String password); void poolSize(int minSize, int maxSize); void isolationLevel(IsolationLevel level); void slowOperationThreshold(Duration threshold); void tooManyRowsReturnedThreshold(int threshold); void maxOperations(int threshold); void longTransactionThreshold(Duration threshold); void timeout(Duration timeout); void batchSize(int size); void view(Class<?> viewClass); void repository(Class<T> entityClass);  }
@Test void validate() { assertThatThrownBy(() -> config.validate()) .hasMessageContaining("db url must be configured"); config.url("jdbc:hsqldb:mem:."); assertThatThrownBy(() -> config.validate()) .hasMessageContaining("db is configured but no repository/view added"); }