Package org.sonar.api.batch.sensor.test.internal

Examples of org.sonar.api.batch.sensor.test.internal.DefaultTestCaseExecution


    this.inputPathCache = inputPathCache;
  }

  @Override
  public void put(Value value, Object object, CoderContext context) {
    DefaultTestCaseExecution t = (DefaultTestCaseExecution) object;
    value.putUTF(((DefaultInputFile) t.testFile()).moduleKey());
    value.putUTF(((DefaultInputFile) t.testFile()).relativePath());
    value.putUTF(t.name());
    putUTFOrNull(value, t.message());
    putUTFOrNull(value, t.stackTrace());
    Long durationInMs = t.durationInMs();
    value.put(durationInMs != null ? durationInMs.longValue() : -1);
    value.put(t.type().ordinal());
    value.put(t.status().ordinal());
  }
View Full Code Here


    String message = value.getString();
    String stack = value.getString();
    long duration = value.getLong();
    TestCaseExecution.Type type = TestCaseExecution.Type.values()[value.getInt()];
    TestCaseExecution.Status status = TestCaseExecution.Status.values()[value.getInt()];
    DefaultTestCaseExecution testCaseExecution = new DefaultTestCaseExecution();
    testCaseExecution
      .inTestFile(testFile)
      .ofType(type)
      .name(name)
      .status(status)
      .message(message)
      .stackTrace(stack);
    if (duration != -1) {
      testCaseExecution.durationInMs(duration);
    }
    return testCaseExecution;
  }
View Full Code Here

    final SensorStorage sensorStorage = mock(SensorStorage.class);

    when(context.newTestCaseExecution()).thenAnswer(new Answer<TestCaseExecution>() {
      @Override
      public TestCaseExecution answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultTestCaseExecution(sensorStorage);
      }
    });

    sensor.execute(context);

    verify(sensorStorage).store(new DefaultTestCaseExecution(null)
      .inTestFile(testFile)
      .name("test1")
      .durationInMs(10));
    verify(sensorStorage).store(new DefaultTestCaseExecution(null)
      .inTestFile(testFile)
      .name("test2")
      .ofType(TestCaseExecution.Type.INTEGRATION)
      .status(TestCaseExecution.Status.ERROR)
      .message("message")
View Full Code Here

    return new DefaultCoverage(this);
  }

  @Override
  public TestCaseExecution newTestCaseExecution() {
    return new DefaultTestCaseExecution(this);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.sensor.test.internal.DefaultTestCaseExecution

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.