com.teamscale.wia.WiaTestUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-wia-test-fixtures Show documentation
Show all versions of teamscale-wia-test-fixtures Show documentation
The Teamscale Work Item Analysis provides the basis to analyze Work Items/Tickets/Requirements/Issues.
package com.teamscale.wia;
import java.io.IOException;
import org.conqat.engine.commons.util.JsonUtils;
import org.conqat.lib.commons.io.SerializationUtils;
import com.fasterxml.jackson.dataformat.toml.TomlMapper;
/**
* Helpers for work item analysis testing.
*/
public class WiaTestUtils {
/** TOML mapper for (de-)serialization. */
private static final TomlMapper MAPPER = JsonUtils.configureDefaultSettings(TomlMapper.builder()).build();
/**
* Convert a work item from its TOML representation to its serialized binary object representation.
*/
public static byte[] tomlWorkItemToBinary(String toml) throws IOException {
TeamscaleIssue workItem = MAPPER.readValue(toml, TeamscaleIssue.class);
return SerializationUtils.serializeToByteArray(workItem);
}
}