Sha256: 3945f8dc4a8d3b07064c055c7f94c6491dc51f54f08327aab44088d7998ae1ba

Contents?: true

Size: 1.14 KB

Versions: 119

Compression:

Stored size: 1.14 KB

Contents

package sh.calaba.instrumentationbackend.actions.spinner;

import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.TestHelpers;
import sh.calaba.instrumentationbackend.actions.Action;
import android.widget.Spinner;

public class GetSelectedSpinnerItemText implements Action {

    @Override
    public Result execute(String... args) {
        final String idArgument = args[0];
        final Spinner foundView = TestHelpers.getViewById(idArgument, Spinner.class);
        
        if( null == foundView ) {
            return notFoundResult(idArgument);
        }
        
        return new Result(true, getSelectedSpinnerText(foundView));
    }

    private String getSelectedSpinnerText(final Spinner foundView) {
        Object selectedItem = foundView.getSelectedItem();
        return (null != selectedItem) ? selectedItem.toString() : "";
    }

    private Result notFoundResult(final String idArgument) {
        return Result.failedResult(String.format("Could not find %s with id %s.", Spinner.class.getName(), idArgument));
    }

    @Override
    public String key() {
        return "get_selected_spinner_item_text";
    }

}

Version data entries

119 entries across 119 versions & 2 rubygems

Version Path
calabash-android-0.4.10.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.10.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.10.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.10.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.9 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
testautoa-0.4.5 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.9.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.9.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.9.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.9.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre10 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre9 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre7 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre6 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java
calabash-android-0.4.7.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java