Package org.sonar.wsclient.services

Examples of org.sonar.wsclient.services.ManualMeasure


public class ManualMeasureUnmarshaller extends AbstractUnmarshaller<ManualMeasure> {

  @Override
  protected ManualMeasure parse(Object json) {
    WSUtils utils = WSUtils.getINSTANCE();
    return new ManualMeasure()
        .setId(utils.getLong(json, "id"))
        .setMetricKey(utils.getString(json, "metric"))
        .setResourceKey(utils.getString(json, "resource"))
        .setCreatedAt(utils.getDateTime(json, "created_at"))
        .setUpdatedAt(utils.getDateTime(json, "updated_at"))
View Full Code Here


public class ManualMeasureUnmarshallerTest extends UnmarshallerTestCase {

  @Test
  public void testSingleMeasure() {
    ManualMeasure measure = new ManualMeasureUnmarshaller().toModel("[]");
    assertThat(measure, nullValue());

    measure = new ManualMeasureUnmarshaller().toModel(loadFile("/manual_measures/single_measure.json"));
    assertThat(measure.getId(), is(1L));
    assertThat(measure.getMetricKey(), is("burned_budget"));
    assertThat(measure.getResourceKey(), is("org.apache.struts:struts-parent"));
    assertThat(measure.getValue(), is(302.5));
    assertThat(measure.getUserLogin(), is("admin"));
    assertThat(measure.getUsername(), is("Administrator"));
    assertThat(measure.getCreatedAt().getDate(), is(27));
    assertThat(measure.getUpdatedAt().getDate(), is(3));
  }
View Full Code Here

TOP

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

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.