Skip to content

Commit

Permalink
Issue eclipse-archived#1021: Implementation of STT Interfaces
Browse files Browse the repository at this point in the history
Signed-off-by: Kelly Davis <kdavis@mozilla.com>
  • Loading branch information
kdavis-mozilla authored and tilmankamp committed May 9, 2016
1 parent 74f6c12 commit 84bf4da
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright (c) 2014-2016 openHAB UG (haftungsbeschraenkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.io.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test general purpose STT exception
*
* @author Kelly Davis - Initial contribution and API
*/
public class STTExceptionTest {
/**
* Test STTException() constructor
*/
@Test
public void testConstructor0() {
STTException ttsException = new STTException();
Assert.assertNotNull("STTException() constructor failed", ttsException);
}

/**
* Test STTException(String message, Throwable cause) constructor
*/
@Test
public void testConstructor1() {
STTException ttsException = new STTException("Message", new Throwable());
Assert.assertNotNull("STTException(String, Throwable) constructor failed", ttsException);
}

/**
* Test STTException(String message) constructor
*/
@Test
public void testConstructor2() {
STTException ttsException = new STTException("Message");
Assert.assertNotNull("STTException(String) constructor failed", ttsException);
}

/**
* Test STTException(Throwable cause) constructor
*/
@Test
public void testConstructor3() {
STTException ttsException = new STTException(new Throwable());
Assert.assertNotNull("STTException(Throwable) constructor failed", ttsException);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2014-2016 openHAB UG (haftungsbeschraenkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.io.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test SpeechRecognitionErrorEvent event
*
* @author Kelly Davis - Initial contribution and API
*/
public class SpeechRecognitionErrorEventTest {
/**
* Test SpeechRecognitionErrorEvent(String) constructor
*/
@Test
public void testConstructor() {
SpeechRecognitionErrorEvent sRE = new SpeechRecognitionErrorEvent("Message");
Assert.assertNotNull("SpeechRecognitionErrorEvent(String) constructor failed", sRE);
}

/**
* Test SpeechRecognitionErrorEvent.getMessage() method
*/
@Test
public void getMessageTest() {
SpeechRecognitionErrorEvent sRE = new SpeechRecognitionErrorEvent("Message");
Assert.assertEquals("SpeechRecognitionErrorEvent.getMessage() method failed", "Message", sRE.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (c) 2014-2016 openHAB UG (haftungsbeschraenkt) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.smarthome.io.voice;

import org.junit.Assert;
import org.junit.Test;

/**
* Test SpeechRecognitionEvent event
*
* @author Kelly Davis - Initial contribution and API
*/
public class SpeechRecognitionEventTest {
/**
* Test SpeechRecognitionEvent(String, float) constructor
*/
@Test
public void testConstructor() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5);
Assert.assertNotNull("SpeechRecognitionEvent(String, float) constructor failed", sRE);
}

/**
* Test SpeechRecognitionEvent.getTranscript() method
*/
@Test
public void getTranscriptTest() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5);
Assert.assertEquals("SpeechRecognitionEvent.getTranscript() method failed", "Message", sRE.getTranscript());
}

/**
* Test SpeechRecognitionEvent.getConfidence() method
*/
@Test
public void getConfidenceTest() {
SpeechRecognitionEvent sRE = new SpeechRecognitionEvent("Message", 0.5);
Assert.assertEquals("SpeechRecognitionEvent.getConfidence() method failed", 0.5, sRE.getConfidence());
}
}

0 comments on commit 84bf4da

Please sign in to comment.