@Test
public void get_by_key() throws Exception {
setupData("shared");
MetricDto result = dao.getNullableByKey(session, "coverage");
assertThat(result.getId()).isEqualTo(2);
assertThat(result.getName()).isEqualTo("coverage");
assertThat(result.getValueType()).isEqualTo("PERCENT");
assertThat(result.getDescription()).isEqualTo("Coverage by unit tests");
assertThat(result.getDirection()).isEqualTo(1);
assertThat(result.isQualitative()).isTrue();
assertThat(result.isUserManaged()).isFalse();
assertThat(result.getWorstValue()).isEqualTo(0d);
assertThat(result.getBestValue()).isEqualTo(100d);
assertThat(result.isOptimizedBestValue()).isFalse();
assertThat(result.isEnabled()).isTrue();
// Disabled metrics are returned
result = dao.getNullableByKey(session, "disabled");
assertThat(result.getId()).isEqualTo(3);
assertThat(result.isEnabled()).isFalse();
}