Package test

Source Code of test.DetectTest

package test;

import junit.framework.TestCase;

import org.junit.Test;

import com.google.api.GoogleAPI;
import com.google.api.detect.Detect;
import com.google.api.detect.DetectResult;
import com.google.api.translate.Language;

/**
* @author Richard Midwinter
*/
public class DetectTest extends TestCase {
  @Test
  public void testDetect() throws Exception {
    System.out.println("testDetect");
   
    GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
   
    DetectResult detectResult = Detect.execute("Hello world");
   
    assertEquals(Language.ENGLISH, detectResult.getLanguage());
    assertTrue(detectResult.getConfidence() > 0);
  }
}
TOP

Related Classes of test.DetectTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.