mirror of
https://github.com/google/nomulus.git
synced 2025-07-03 01:33:29 +02:00
Change EppMetric.Builder to use @AutoValue.Builder
Getting rid of builder boilerplate makes my heart sing. Since we can no longer @Inject the Builder() constructor, this change adds a provider in WhiteboxModule that calls a special builderForRequest() factory method, which gets passed a request ID and Clock and preserves the existing EppMetric magic that sets the start and end time for you. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132714432
This commit is contained in:
parent
ceb5c2117e
commit
2537e95de5
10 changed files with 108 additions and 107 deletions
|
@ -42,13 +42,13 @@ interface EppTestComponent {
|
|||
@Module
|
||||
static class FakesAndMocksModule {
|
||||
final FakeClock clock;
|
||||
final EppMetric.Builder metrics;
|
||||
final EppMetric.Builder metricBuilder;
|
||||
final BigQueryMetricsEnqueuer metricsEnqueuer;
|
||||
final ModulesService modulesService;
|
||||
|
||||
FakesAndMocksModule(FakeClock clock) {
|
||||
this.clock = clock;
|
||||
this.metrics = new EppMetric.Builder();
|
||||
this.metricBuilder = EppMetric.builderForRequest("request-id-1", clock);
|
||||
this.modulesService = mock(ModulesService.class);
|
||||
this.metricsEnqueuer = mock(BigQueryMetricsEnqueuer.class);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ interface EppTestComponent {
|
|||
|
||||
@Provides
|
||||
EppMetric.Builder provideMetrics() {
|
||||
return metrics;
|
||||
return metricBuilder;
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue