public static TestResult createTestResult(String key, String fingerprint, String name,
											  String category, long duration, String message,
											  boolean passed, Boolean active, Set<String> contributors,
											  Set<String> tags, Set<String> tickets, Map<String, String> data) {

		if (duration < 0) {
			throw new IllegalArgumentException("The duration cannot be negative.");
		}

		if (fingerprint == null || fingerprint.isEmpty()) {
			throw new IllegalArgumentException("The fingerprint is mandatory.");
		}

		TestResult testResult = new TestResult();

		if (!passed) {
			if (message == null) {
				testResult.setMessage("No message available.");
			}
			else if (message.isEmpty()) {
				testResult.setMessage("Failing message was empty.");
			}
		}
		
		if (key != null && !key.isEmpty()) {
			testResult.setKey(key);
		}

		testResult.setFingerprint(fingerprint);
		testResult.setName(name);
		testResult.setDuration(duration);
		testResult.setPassed(passed);
		
		if (testResult.getMessage() == null) {
			if (message != null && message.getBytes(Charset.forName(Constants.ENCODING)).length > 50000) {
				testResult.setMessage(new String(message.getBytes(Charset.forName(Constants.ENCODING)), 0, 49997, Charset.forName(Constants.ENCODING)) + "...");
			}
			else {
				testResult.setMessage(message);
			}
		}
		
		if (category != null && !category.isEmpty()) {
			testResult.setCategory(category);
		}

		if (active != null) {
			testResult.setActive(active);
		}
		
		if (tags != null) {
			testResult.addTags(tags);
		}

		if (contributors != null) {
			testResult.addContributors(contributors);
		}
		
		if (tickets != null) {
			testResult.addTickets(tickets);
		}
		
		if (data != null) {
			testResult.addData(data);
		}

		// Add the fingerprint in the data to help the migration of the server data
		testResult.addData("fingerprint", fingerprint);
		
		return testResult;
	}
public static TestResult createTestResult ( String key , String fingerprint , String name , String category , long duration , String message , boolean passed , Boolean active , Set < String > contributors , Set < String > tags , Set < String > tickets , Map < String , String > data ) { if ( duration < 0 ) { throw new IllegalArgumentException ( "The duration cannot be negative." ) ; } if ( fingerprint == null || fingerprint . isEmpty ( ) ) { throw new IllegalArgumentException ( "The fingerprint is mandatory." ) ; } TestResult testResult = new TestResult ( ) ; if ( ! passed ) { if ( message == null ) { testResult . setMessage ( "No message available." ) ; } else if ( message . isEmpty ( ) ) { testResult . setMessage ( "Failing message was empty." ) ; } } if ( key != null && ! key . isEmpty ( ) ) { testResult . setKey ( key ) ; } testResult . setFingerprint ( fingerprint ) ; testResult . setName ( name ) ; testResult . setDuration ( duration ) ; testResult . setPassed ( passed ) ; if ( testResult . getMessage ( ) == null ) { if ( message != null && message . getBytes ( Charset . forName ( Constants . ENCODING ) ) . length > 50000 ) { testResult . setMessage ( new String ( message . getBytes ( Charset . forName ( Constants . ENCODING ) ) , 0 , 49997 , Charset . forName ( Constants . ENCODING ) ) + "..." ) ; } else { testResult . setMessage ( message ) ; } } if ( category != null && ! category . isEmpty ( ) ) { testResult . setCategory ( category ) ; } if ( active != null ) { testResult . setActive ( active ) ; } if ( tags != null ) { testResult . addTags ( tags ) ; } if ( contributors != null ) { testResult . addContributors ( contributors ) ; } if ( tickets != null ) { testResult . addTickets ( tickets ) ; } if ( data != null ) { testResult . addData ( data ) ; } testResult . addData ( "fingerprint" , fingerprint ) ; return testResult ; }
Create a test result

@param key The unique key that identifies the test (mandatory)
@param name Name
@param duration Approximative duration time (0 or positive)
@param message Message to enrich the result (mandatory when failed, max. 65535 car, truncated)
@param passed Flag to know if a test pass or not
@param active if the test is active
@param contributors A list of contributors
@param tags A list of tags
@param tickets A list of tickets
@param data A list of meta data
@return Created test