@Test public void should_execute_on_java_project() { Project project = mock(Project.class); when(project.getLanguageKey()).thenReturn("java"); assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); when(project.getLanguageKey()).thenReturn("py"); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); }