本文整理汇总了Java中guru.nidi.codeassert.dependency.DependencyRuler类的典型用法代码示例。如果您正苦于以下问题:Java DependencyRuler类的具体用法?Java DependencyRuler怎么用?Java DependencyRuler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DependencyRuler类属于guru.nidi.codeassert.dependency包,在下文中一共展示了DependencyRuler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clientDoesNotRelyOnComposing
import guru.nidi.codeassert.dependency.DependencyRuler; //导入依赖的package包/类
@Test
public void clientDoesNotRelyOnComposing() {
class ComRewedigitalExamplesMsintegrationComposer extends DependencyRuler {
DependencyRule client, composing, parser, proxy, routing, util;
@Override
public void defineRules() {
base().mayUse(base().allSub());
client.mayUse(util).mustNotUse(composing);
parser.mayUse(util).mustNotUse(composing);
composing.mayUse(client, parser, util).mustNotUse(proxy, routing);
proxy.mayUse(composing, routing, util).mustNotUse(client);
}
}
DependencyRules rules = DependencyRules.denyAll()
.withRelativeRules(new ComRewedigitalExamplesMsintegrationComposer())
.withExternals("java.*", "org.*", "net.*", "com.spotify.*", "com.google.*",
"com.damnhandy.*", "okio");
DependencyResult result = new DependencyAnalyzer(config).rules(rules).analyze();
assertThat(result, matchesRulesExactly());
}
示例2: dependencies
import guru.nidi.codeassert.dependency.DependencyRuler; //导入依赖的package包/类
@Test
public void dependencies() {
class GuruNidiRamltester extends DependencyRuler {
DependencyRule $self, core, httpcomponents, restassured, restassured3, junit, validator, model, servlet, spring, jaxrs, util;
public void defineRules() {
$self.mayUse(model, core, servlet, httpcomponents, restassured, restassured3, spring, jaxrs, validator, junit, util);
core.mayUse(model, util);
util.mayUse(model);
servlet.mayUse(model, util, core);
httpcomponents.mayUse(model, util, core);
restassured.mayUse(model, core);
restassured3.mayUse(model, core);
junit.mayUse(util, core);
validator.mayUse(util, core);
spring.mayUse(model, util, core, servlet);
jaxrs.mayUse(model, util, core);
}
}
//TODO dependencies to externals (spring, httpcomponents etc.)
final DependencyRules rules = DependencyRules.denyAll()
.withExternals("java*", "org*", "com*", "io*", "guru.nidi.loader*")
.withRelativeRules(new GuruNidiRamltester());
assertThat(modelResult(), packagesMatchExactly(rules));
}
示例3: dependencies
import guru.nidi.codeassert.dependency.DependencyRuler; //导入依赖的package包/类
@Test
public void dependencies() {
class GuruNidiRamlproxy extends DependencyRuler {
DependencyRule report, cli, jetty, core, data;
@Override
public void defineRules() {
cli.mayUse(core, report, base());
base().mayUse(core, report, jetty);
jetty.mayUse(core, report);
core.mayUse(report, data);
report.mayUse(data);
}
}
final DependencyRules rules = DependencyRules.denyAll()
.withExternals("java*", "org*", "com*", "guru.nidi.ramltester*")
.withRelativeRules(new GuruNidiRamlproxy());
assertThat(modelResult(), packagesMatchExactly(rules));
}