use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method send_should_NOT_set_result_if_result_exists.
@Test
public void send_should_NOT_set_result_if_result_exists() throws InterruptedException {
// given
ActionMessage message = builder.action("jolly jumper");
String result = "spits like a cowboy";
message.result(result);
// when
TelemetryEvent event = message.send();
// then dont override existing result
assertThat(event.getProperties().get(PROP_RESULT)).isEqualTo(result);
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method error_should_anonymize_email.
@Test
public void error_should_anonymize_email() {
// given
ActionMessage message = builder.action("the simpsons");
String email = "bart@simpsons.com";
// when
message.error(email + " caused a nuclear plant emergency");
// then
assertThat(message.getError()).doesNotContain(email);
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method error_should_anonymize_username.
@Test
public void error_should_anonymize_username() {
// given
ActionMessage message = builder.action("the simpsons");
// when
String username = AnonymizeUtils.USER_NAME;
message.error(username + " caused a nuclear plant emergency");
// then
assertThat(message.getError()).doesNotContain(username);
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method error_should_clear_result.
@Test
public void error_should_clear_result() {
// given
ActionMessage message = builder.action("the simpsons").result("went skateboarding");
// when
message.error("nuclear plant emergency");
// then
assertThat(message.getResult()).isNull();
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method finished_should_set_duration_btw_given_start_and_finished_when_finished_is_in_new_year.
@Test
public void finished_should_set_duration_btw_given_start_and_finished_when_finished_is_in_new_year() {
// given
ActionMessage message = builder.action("the daltons break out");
LocalDateTime started = LocalDateTime.of(LocalDate.now(), LocalTime.of(23, 0));
message.started(started);
Duration duration = Duration.of(2, ChronoUnit.HOURS).plusDays(356 + 30);
LocalDateTime stopped = started.plus(duration);
// when local time is next year
message.finished(stopped);
// then
assertThat(TimeUtils.toDuration(message.getDuration())).isEqualTo(duration);
}
Aggregations