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_NOT_NPE_for_given_null_exception.
@Test
public void error_should_NOT_NPE_for_given_null_exception() {
// given
ActionMessage message = builder.action("the simpsons");
// when
message.error((Exception) null);
// 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 action_should_create_message_with_given_name.
@Test
public void action_should_create_message_with_given_name() {
// given
String name = "papa smurf";
// when
ActionMessage message = builder.action(name);
// then
assertThat(message.getName()).isEqualTo(name);
}
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_ignore_property_with_null_key.
@Test
public void property_should_ignore_property_with_null_key() {
// given
ActionMessage message = builder.action("smurfette");
int beforeAdding = message.properties().size();
// when
message.property(null, "papa smurf");
// then
assertThat(message.properties().size()).isEqualTo(beforeAdding);
}
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_set_result_property.
@Test
public void result_should_set_result_property() {
// given
ActionMessage message = builder.action("flinstones");
String result = "crushed stones";
// when
message.result(result);
// then
assertThat(message.getResult()).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 send_should_NOT_set_duration_if_already_exists.
@Test
public void send_should_NOT_set_duration_if_already_exists() throws InterruptedException {
// given
ActionMessage message = builder.action("jolly jumper");
Duration existing = Duration.ofDays(7);
message.duration(existing);
// when
TelemetryEvent event = message.send();
// then dont override existing duration
assertThat(TimeUtils.toDuration(event.getProperties().get(PROP_DURATION))).isEqualTo(existing);
}
Aggregations