APISonar


io.qameta.allure.entity.Time.Time

> io > qameta > allure > entity > Time > Time
io APIs qameta APIs allure APIs entity APIs Time APIs Time APIs

Example 1
private Time getTime(final String startTime, final String endTime) {
        final Time time = new Time();
        parseTime(startTime).ifPresent(time::setStart);
        parseTime(endTime).ifPresent(time::setStop);
        if (Objects.nonNull(time.getStart()) && Objects.nonNull(time.getStop())) {
            time.setDuration(time.getStop() - time.getStart());
        }
        return time;
    }
Example 2
private Time getTime(final XmlElement testElement) {
        if (testElement.containsAttribute(TIME_ATTRIBUTE_NAME)) {
            try {
                final long duration = BigDecimal.valueOf(testElement.getDoubleAttribute(TIME_ATTRIBUTE_NAME))
                        .multiply(MULTIPLICAND)
                        .longValue();
                return new Time().setDuration(duration);
            } catch (Exception e) {
                LOGGER.debug("Could not parse time attribute for element test", e);
            }
        }
        return new Time();
    }
Example 3
private static Time getStepTime(final Map<String, Object> props) {
        final long start = parseTime(props.getOrDefault(STEP_START_TIME, "0").toString());
        final long stop = parseTime(props.getOrDefault(STEP_STOP_TIME, "0").toString());
        return new Time().setStart(start).setStop(stop).setDuration(stop - start);
    }
Example 4
private TestResult createTestResult(Status status, String historyId, long start, long stop) {
        return randomTestResult()
                .setHistoryId(historyId)
                .setStatus(status)
                .setTime(new Time().setStart(start).setStop(stop));
    }
Example 5
private List<StageResult> convertHooks(final Hook... hooks) {
        return Stream.of(hooks)
                .map(hook -> new StageResult()
                        .withAttachments(
                                Stream.of(hook.getEmbeddings())
                                        .map(this::convertAttachment)
                                        .collect(Collectors.toList()))
                        .withStatusDetails(getStatusDetails(hook.getResult()))
                        .withTime(new Time().withDuration(hook.getResult().getDuration()))
                ).collect(Collectors.toList());
    }