<BUG>MockUserSession.set().addComponentPermission(UserRole.USER, PROJECT_KEY, COMPONENT_KEY);</BUG><CONTEXT>verify(measureDao).findByComponentKeyAndMetricKeys(eq(componentKey), measureKeysCaptor.capture(), eq(session));assertThat(measureKeysCaptor.getValue()).contains(CoreMetrics.TESTS_KEY);}@Testpublic void app_with_periods() throws Exception {<extra_id_0>addComponent();when(resourceDao.getLastSnapshotByResourceId(eq(1L), eq(session))).thenReturn(new SnapshotDto().setPeriod1Mode("previous_analysis").setPeriod1Date(DateUtils.parseDate("2014-05-08"))</CONTEXT>
MockUserSession.set().addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY);