use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method action_should_create_message_with_action_type.
@Test
public void action_should_create_message_with_action_type() {
// given
// when
ActionMessage message = builder.action("azrael");
// then
assertThat(message.getType()).isEqualTo(ACTION);
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method result_should_clear_error.
@Test
public void result_should_clear_error() {
// given
ActionMessage message = builder.action("flinstones").error("went bowling");
// when
message.result("crushed stones");
// then
assertThat(message.getError()).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_stop_is_new_day.
@Test
public void finished_should_set_duration_btw_given_start_and_finished_when_stop_is_new_day() {
// given
ActionMessage message = builder.action("inspector gadget hits the button");
LocalDateTime started = LocalDateTime.of(LocalDate.now(), LocalTime.of(23, 0));
message.started(started);
int hours = 2;
LocalDateTime stopped = started.plusHours(hours);
// when local time is crossing into new day
message.finished(stopped);
// then
assertThat(TimeUtils.toDuration(message.getDuration())).isEqualTo(Duration.ofHours(hours));
}
use of com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.ActionMessage in project intellij-redhat-telemetry by redhat-developer.
the class TelemetryMessageBuilderTest method property_should_add_property_with_given_key_and_name.
@Test
public void property_should_add_property_with_given_key_and_name() {
// given
String key = "likes";
String value = "papa smurf";
// when
ActionMessage message = builder.action("smurfette").property(key, value);
// then
assertThat(message.getProperty(key)).isEqualTo(value);
}
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_homedir.
@Test
public void error_should_anonymize_homedir() {
// given
ActionMessage message = builder.action("the smurfs");
// when
String homedir = AnonymizeUtils.HOME_DIR;
message.error(homedir + " is their village");
// then
assertThat(message.getError()).doesNotContain(homedir);
}
Aggregations