* @param map
* @return Test Case.
*/
public static final TestCase getTestCase(Map<String, Object> map)
{
TestCase testCase = null;
if ( map != null && map.size() > 0 )
{
Object o = map.get( TestLinkResponseParams.id.toString());
if ( o != null )
{
Integer id = Integer.parseInt( o.toString() );
if ( id > 0 )
{
testCase = new TestCase();
testCase.setId( id );
testCase.setVersionId( getInteger(map, TestLinkResponseParams.testCaseVersionId.toString()) );
testCase.setVersion( getInteger(map, TestLinkResponseParams.version.toString() ) );
testCase.setPreconditions( getString(map, TestLinkResponseParams.preconditions.toString()));
testCase.setSummary( getString(map, TestLinkResponseParams.summary.toString()) );
testCase.setParentId( getInteger(map, TestLinkResponseParams.parentId.toString() ) );
testCase.setOrder( getInteger(map, TestLinkResponseParams.order.toString() ) );
testCase.setExecutionOrder( getInteger(map, TestLinkResponseParams.executionOrder.toString()));
testCase.setName( getString(map, TestLinkResponseParams.name.toString()) );
Integer executionTypeValue = getInteger( map, TestLinkResponseParams.executionType.toString() );
ExecutionType execution = ExecutionType.getExecutionType( executionTypeValue );
testCase.setExecutionType( execution );
ExecutionStatus executionStatus = ExecutionStatus.NOT_RUN;
String executionStatusText = getString(map, TestLinkResponseParams.execStatus.toString() );
if ( StringUtils.isNotBlank(executionStatusText) )
{
executionStatus = ExecutionStatus.getExecutionStatus(executionStatusText.charAt(0));
}
testCase.setExecutionStatus(executionStatus);
testCase.setTestProjectId(getInteger(map, TestLinkParams.testProjectId.toString()));
// TODO: check if TL 2.0 allows it
// CustomField[] customFields = (CustomField[])getArray(map, TestLinkResponseParams.customFields.toString());
// if ( customFields != null )
// {
// for (int i = 0; i < customFields.length; i++)