Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.Metric


public class MetricUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void toModel() {
    Metric metric = new MetricUnmarshaller().toModel("[]");
    assertThat(metric, nullValue());

    metric = new MetricUnmarshaller().toModel(loadFile("/metrics/one_metric.json"));
    assertThat(metric.getKey(), is("ncloc"));
    assertThat(metric.getName(), is("Lines of code"));
    assertThat(metric.getDescription(), is("Non Commenting Lines of Code"));
    assertThat(metric.getType(), is("INT"));
    assertTrue(metric.getHidden());
  }
View Full Code Here


public class MetricUnmarshaller extends AbstractUnmarshaller<Metric> {

  @Override
  protected Metric parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    return new Metric()
        .setKey(utils.getString(json, "key"))
        .setName(utils.getString(json, "name"))
        .setDomain(utils.getString(json, "domain"))
        .setDescription(utils.getString(json, "description"))
        .setDirection(utils.getInteger(json, "direction"))
View Full Code Here

TOP

Related Classes of org.sonar.wsclient.services.Metric

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.