### Question:
RevisionHistoryEnricher extends BaseEnricher { @Override public void create(PlatformMode platformMode, KubernetesListBuilder builder) { final Integer maxRevisionHistories = Configs.asInt(getConfig(Config.limit)); log.info("Adding revision history limit to %s", maxRevisionHistories); if(platformMode == PlatformMode.kubernetes) { builder.accept(new TypedVisitor<DeploymentBuilder>() { @Override public void visit(DeploymentBuilder item) { item.editOrNewSpec() .withRevisionHistoryLimit(maxRevisionHistories) .endSpec(); } }); } else { builder.accept(new TypedVisitor<DeploymentConfigBuilder>() { @Override public void visit(DeploymentConfigBuilder item) { item.editOrNewSpec() .withRevisionHistoryLimit(maxRevisionHistories) .endSpec(); } }); } } RevisionHistoryEnricher(MavenEnricherContext buildContext); @Override void create(PlatformMode platformMode, KubernetesListBuilder builder); static final String DEFAULT_NAME; }### Answer:
@Test public void testDefaultRevisionHistoryLimit() throws JsonProcessingException { KubernetesListBuilder builder = new KubernetesListBuilder() .addNewDeploymentItem() .endDeploymentItem(); RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context); enricher.create(PlatformMode.kubernetes, builder); assertRevisionHistory(builder.build(), Configs.asInt(RevisionHistoryEnricher.Config.limit.def())); }
@Test public void testCustomRevisionHistoryLimit() throws JsonProcessingException { final String revisionNumber = "10"; new Expectations() {{ Configuration config = new Configuration.Builder().processorConfig(prepareEnricherConfig(revisionNumber)).build(); context.getConfiguration(); result = config; }}; KubernetesListBuilder builder = new KubernetesListBuilder() .addNewDeploymentItem() .endDeploymentItem(); RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context); enricher.create(PlatformMode.kubernetes, builder); assertRevisionHistory(builder.build(), Integer.parseInt(revisionNumber)); }