Sha256: be8cdbc44550dd24947b04c6902f77b0453804f0fd6f6360baf478e1eaa084cd

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 KB

Contents

package sh.calaba.instrumentationbackend;

import java.io.CharArrayWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

public class Result {
	
    boolean success;
    String message;
    List<String> bonusInformation = new ArrayList<String>();
    	
    public Result() {
    }
    
    public Result(boolean success) {
		this(success, "");
    }
    
    public Result(boolean success, String message) {
		this.success = success;
		this.message = message;
    }
    
    public String getMessage() {
    	return message;
    }
    
    public void setMessage(String message) {
    	this.message = message;
    }
    
    public boolean isSuccess() {
    	return success;
    }
    
    public void setSuccess(boolean success) {
    	this.success = success;
    }
    
    public void addBonusInformation(String information) {
    	bonusInformation.add(information);
	}

    public List<String> getBonusInformation() {
		return bonusInformation;
	}
    
    public void setExtras(List<String> bonusInformation) {
		this.bonusInformation = bonusInformation;
    }
        
    public static Result fromThrowable(Throwable t) {
    	Result r = new Result(false, t.getMessage());
    	CharArrayWriter caw = new CharArrayWriter();
    	t.printStackTrace(new PrintWriter(caw));
    	r.addBonusInformation("Exception stack trace:\n" + caw.toString());
    	return r;
    }
    
    public static Result successResult() {
    	return new Result(true);
    }

    public static Result failedResult() {
        return new Result(false);
    }

    public static Result failedResult(final String message) {
        return new Result(false, message);
    }
    
    public String toString() {
        return "Success: " + success + ", message: " + message;
    }
}

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
calabash-android-0.4.0.pre6 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
calabash-android-0.4.0.pre5 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
calabash-android-0.4.0.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
calabash-android-0.4.0.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
testautoa-0.4.0 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
calabash-android-0.4.0.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java