MetricNamesGenerator { public String getOnActivityPausedMetricName(Activity activity) { String activityName = getActivityName(activity); return MetricRegistry.name( appendCrossMetricInfo(UI + SEPARATOR + ON_ACTIVITY_PAUSED + SEPARATOR + activityName)); } MetricNamesGenerator(App app, Device device, Time time); String getFrameTimeMetricName(Activity activity); String getOnActivityCreatedMetricName(Activity activity); String getOnActivityStartedMetricName(Activity activity); String getOnActivityResumedMetricName(Activity activity); String getActivityVisibleMetricName(Activity activity); String getOnActivityPausedMetricName(Activity activity); String getOnActivityStoppedMetricName(Activity activity); String getOnActivityDestroyedMetricName(Activity activity); String getBytesDownloadedMetricName(boolean isInBackground); String getBytesUploadedMetricName(boolean isInBackground); String getCPUUsageMetricName(boolean isInBackground); String getMemoryUsageMetricName(boolean forBackground); String getBytesAllocatedMetricName(boolean forBackground); String getInternalStorageWrittenBytes(boolean isInBackground); String getSharedPreferencesWrittenBytes(boolean isInBackground);  }
@Test public void onActivityPausedMetricNameShouldContainExactly12FieldsSeparatedByDots() { String name = generator.getOnActivityPausedMetricName(activity); assertEquals(13, MetricNameUtils.split(name).length); }
@Test public void onActivityPausedMetricNameShouldContainTheCrossMetricInfoName() { String name = generator.getOnActivityPausedMetricName(activity); assertContainsCrossMetricInfoName(name); }
@Test public void onActivityPausedMetricContainsTheMetricNameInTheCorrectPosition() { String name = generator.getOnActivityPausedMetricName(activity); String[] parts = MetricNameUtils.split(name); assertEquals("onActivityPaused", parts[11]); }
@Test public void identifiesAnOnActivityPausedMetricProperly() { String name = generator.getOnActivityPausedMetricName(activity); assertTrue(extractor.isOnActivityPausedMetric(name)); }