I have been inspired buy this book: Building Evolutionary Architectures and clean architecture.
One of the concept is to be able to test your architecture in the code. In particular I would like to be able to check dependencies between namespaces, layers and assert that a namespace doesn't call a namespace for another layer.
All my namespaces are inside the circles:
The idea is that a namespace inside 'controllers' can not import a namespace inside 'entities' but only import namespaces below him (use-cases). And I would like to detect this in my unit tests.
So this should fail in my unit tests:
(ns com.controller.core
(:require [com.entities.core :as entities]
[com.use-cases.core :as use-cases]))
(defn do-something [args]
(let [use-cases-results (use-cases/do-something args)]
(entities/do-some-other-thing use-cases-results)))
In java you can write those sort of unit tests using archunit.
private final JavaClasses classes = new ClassFileImporter().importPackagesOf(Controller/core.class);
noClasses().that().resideInAPackage("..controller..").should().accessClassesThat().resideInAPackage("..use-cases..").check(classes);
Are you using something similar for clojure or do you have some suggestions how to tackle this problem?