use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.
the class FirebasePerfTraceValidatorTest method testExceedMaxSubtrace.
@Test
public void testExceedMaxSubtrace() {
TraceMetric.Builder trace = createValidTraceMetric();
TraceMetric.Builder subtrace = createValidTraceMetric();
TraceMetric subSubtrace = createValidTraceMetric().build();
subtrace.addSubtraces(subSubtrace);
trace.addSubtraces(subtrace);
assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
}
use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.
the class FirebasePerfTraceValidatorTest method testEmptyCounterId.
@Test
public void testEmptyCounterId() {
TraceMetric trace = createValidTraceMetric().putCounters("", 10).build();
assertThat(new FirebasePerfTraceValidator(trace).isValidPerfMetric()).isFalse();
}
use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.
the class FirebasePerfTraceValidatorTest method testIsValid.
@Test
public void testIsValid() {
TraceMetric.Builder trace = createValidTraceMetric().putCounters("counter", 2);
TraceMetric subtrace = createValidTraceMetric().setName("subtrace1").putCounters("subtraceCounter", 2).build();
trace.addSubtraces(subtrace);
assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isTrue();
}
use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.
the class FirebasePerfTraceValidatorTest method testInvalidSubtrace.
@Test
public void testInvalidSubtrace() {
TraceMetric.Builder trace = createValidTraceMetric();
TraceMetric subtrace = createValidTraceMetric().clearName().build();
trace.addSubtraces(subtrace);
assertThat(new FirebasePerfTraceValidator(trace.build()).isValidPerfMetric()).isFalse();
}
use of com.google.firebase.perf.v1.TraceMetric in project firebase-android-sdk by firebase.
the class TraceMetricBuilderTest method testAddingAttributeWithNullValue.
@Test
public void testAddingAttributeWithNullValue() {
Trace trace = new Trace(TRACE_1, transportManager, clock, appStateMonitor);
currentTime = 1;
trace.start();
currentTime = 2;
trace.putAttribute(TRACE_ATTRIBUTE_KEY, null);
currentTime = 3;
trace.stop();
TraceMetric traceMetric = new TraceMetricBuilder(trace).build();
Assert.assertEquals(TRACE_1, traceMetric.getName());
Assert.assertEquals(0, traceMetric.getCustomAttributesCount());
}
Aggregations