Android Open Source - wit-android-sdk Wit Test






From Project

Back to project page wit-android-sdk.

License

The source code is released under:

/** * Copyright (c) 2014, Wit.ai, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source c...

If you think the Android project wit-android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ai.wit.sdk;
/*from ww w . ja  v  a2 s.co m*/
import android.app.Activity;
import android.test.AndroidTestCase;

import com.google.gson.JsonElement;

import java.util.HashMap;

/*
    Copyright 2013 Wit Inc. All rights reserved.
 */

/**
 * Created by Wit on 7/14/13.
 */
public class WitTest extends AndroidTestCase{

    @Override
    protected void setUp() throws java.lang.Exception
    {
        super.setUp();
    }

    public void testWitCaptureTextCorrectlyWithTextNull() {
        Wit wit = new Wit();
        WitListenerTest listener = new WitListenerTest();
        wit.onAttach(listener);
        wit.captureTextIntent(null);
        assertEquals(null, listener._intent);
        assertEquals(null, listener._body);
        assertEquals(null, listener._entities);
        assertEquals(0.0, listener._confidence);
        assertNotNull(listener._error);
    }

    private class WitListenerTest extends Activity implements IWitListener {

        String _intent;
        HashMap<String, JsonElement> _entities;
        String _body;
        double _confidence;
        Error _error;

        @Override
        public void witDidGraspIntent(String intent, HashMap<String,JsonElement> entities, String body, double confidence, Error error) {
            _intent = intent;
            _entities = entities;
            _body = body;
            _confidence = confidence;
            _error = error;
        }
    }
}




Java Source Code List

ai.wit.sdk.IWitCoordinator.java
ai.wit.sdk.IWitListener.java
ai.wit.sdk.WitContextSetter.java
ai.wit.sdk.WitMessageRequestTask.java
ai.wit.sdk.WitMic.java
ai.wit.sdk.WitRequest.java
ai.wit.sdk.WitSpeechRequestTask.java
ai.wit.sdk.WitTest.java
ai.wit.sdk.Wit.java
ai.wit.sdk.model.WitOutcome.java
ai.wit.sdk.model.WitResponse.java