@@ -150,6 +150,8 @@ public class SpeechToTextTest extends WatsonServiceUnitTest {
150150 private static final File SAMPLE_WAV = new File ("src/test/resources/speech_to_text/sample1.wav" );
151151 private static final File SAMPLE_WEBM = new File ("src/test/resources/speech_to_text/sample1.webm" );
152152
153+ private static final String UPDATED = "2019-10-11T19:16:58.547Z" ;
154+
153155 private SpeechModel speechModel ;
154156 private SpeechModels speechModels ;
155157 private SpeechRecognitionResults recognitionResults ;
@@ -182,6 +184,81 @@ public void setUp() throws Exception {
182184 grammar = loadFixture ("src/test/resources/speech_to_text/grammar.json" , Grammar .class );
183185 }
184186
187+ // --- MODELS ---
188+
189+ @ Test
190+ public void testDeleteUserDataOptionsBuilder () {
191+ String customerId = "customerId" ;
192+
193+ DeleteUserDataOptions deleteOptions = new DeleteUserDataOptions .Builder ()
194+ .customerId (customerId )
195+ .build ();
196+
197+ assertEquals (deleteOptions .customerId (), customerId );
198+ }
199+
200+ @ Test
201+ public void testAddGrammarOptions () throws FileNotFoundException {
202+ String customizationId = "id" ;
203+ String grammarName = "grammar_name" ;
204+ InputStream grammarFile = new FileInputStream (SAMPLE_WAV );
205+
206+ AddGrammarOptions addGrammarOptions = new AddGrammarOptions .Builder ()
207+ .customizationId (customizationId )
208+ .grammarName (grammarName )
209+ .grammarFile (grammarFile )
210+ .contentType (AddGrammarOptions .ContentType .APPLICATION_SRGS )
211+ .allowOverwrite (true )
212+ .build ();
213+
214+ assertEquals (customizationId , addGrammarOptions .customizationId ());
215+ assertEquals (grammarName , addGrammarOptions .grammarName ());
216+ assertEquals (grammarFile , addGrammarOptions .grammarFile ());
217+ assertEquals (AddGrammarOptions .ContentType .APPLICATION_SRGS , addGrammarOptions .contentType ());
218+ assertTrue (addGrammarOptions .allowOverwrite ());
219+ }
220+
221+ @ Test
222+ public void testListGrammarsOptions () {
223+ String customizationId = "id" ;
224+
225+ ListGrammarsOptions listGrammarsOptions = new ListGrammarsOptions .Builder ()
226+ .customizationId (customizationId )
227+ .build ();
228+
229+ assertEquals (customizationId , listGrammarsOptions .customizationId ());
230+ }
231+
232+ @ Test
233+ public void testGetGrammarOptions () {
234+ String customizationId = "id" ;
235+ String grammarName = "grammar_name" ;
236+
237+ GetGrammarOptions getGrammarOptions = new GetGrammarOptions .Builder ()
238+ .customizationId (customizationId )
239+ .grammarName (grammarName )
240+ .build ();
241+
242+ assertEquals (customizationId , getGrammarOptions .customizationId ());
243+ assertEquals (grammarName , getGrammarOptions .grammarName ());
244+ }
245+
246+ @ Test
247+ public void testDeleteGrammarOptions () {
248+ String customizationId = "id" ;
249+ String grammarName = "grammar_name" ;
250+
251+ DeleteGrammarOptions deleteGrammarOptions = new DeleteGrammarOptions .Builder ()
252+ .customizationId (customizationId )
253+ .grammarName (grammarName )
254+ .build ();
255+
256+ assertEquals (customizationId , deleteGrammarOptions .customizationId ());
257+ assertEquals (grammarName , deleteGrammarOptions .grammarName ());
258+ }
259+
260+ // --- METHODS ---
261+
185262 /**
186263 * Test get model.
187264 *
@@ -655,6 +732,7 @@ public void testGetLanguageModel() throws InterruptedException, FileNotFoundExce
655732 assertEquals ("GET" , request .getMethod ());
656733 assertEquals (String .format (PATH_CUSTOMIZATION , id ), request .getPath ());
657734 assertEquals (result .toString (), model .toString ());
735+ assertEquals (UPDATED , result .getUpdated ());
658736 }
659737
660738 /**
@@ -1163,6 +1241,7 @@ public void testGetAcousticModel() throws InterruptedException, FileNotFoundExce
11631241 assertEquals ("GET" , request .getMethod ());
11641242 assertEquals (String .format (PATH_ACOUSTIC_CUSTOMIZATION , id ), request .getPath ());
11651243 assertEquals (result .toString (), model .toString ());
1244+ assertEquals (UPDATED , result .getUpdated ());
11661245 }
11671246
11681247 /**
@@ -1424,38 +1503,6 @@ public void testClosingInputStreamClosesWebSocket() throws Exception {
14241503 callback .assertOnTranscriptionComplete ();
14251504 }
14261505
1427- @ Test
1428- public void testDeleteUserDataOptionsBuilder () {
1429- String customerId = "customerId" ;
1430-
1431- DeleteUserDataOptions deleteOptions = new DeleteUserDataOptions .Builder ()
1432- .customerId (customerId )
1433- .build ();
1434-
1435- assertEquals (deleteOptions .customerId (), customerId );
1436- }
1437-
1438- @ Test
1439- public void testAddGrammarOptions () throws FileNotFoundException {
1440- String customizationId = "id" ;
1441- String grammarName = "grammar_name" ;
1442- InputStream grammarFile = new FileInputStream (SAMPLE_WAV );
1443-
1444- AddGrammarOptions addGrammarOptions = new AddGrammarOptions .Builder ()
1445- .customizationId (customizationId )
1446- .grammarName (grammarName )
1447- .grammarFile (grammarFile )
1448- .contentType (AddGrammarOptions .ContentType .APPLICATION_SRGS )
1449- .allowOverwrite (true )
1450- .build ();
1451-
1452- assertEquals (customizationId , addGrammarOptions .customizationId ());
1453- assertEquals (grammarName , addGrammarOptions .grammarName ());
1454- assertEquals (grammarFile , addGrammarOptions .grammarFile ());
1455- assertEquals (AddGrammarOptions .ContentType .APPLICATION_SRGS , addGrammarOptions .contentType ());
1456- assertTrue (addGrammarOptions .allowOverwrite ());
1457- }
1458-
14591506 @ Test
14601507 public void testAddGrammar () throws FileNotFoundException , InterruptedException {
14611508 MockResponse desiredResponse = new MockResponse ().setResponseCode (200 );
@@ -1477,17 +1524,6 @@ public void testAddGrammar() throws FileNotFoundException, InterruptedException
14771524 assertEquals (POST , request .getMethod ());
14781525 }
14791526
1480- @ Test
1481- public void testListGrammarsOptions () {
1482- String customizationId = "id" ;
1483-
1484- ListGrammarsOptions listGrammarsOptions = new ListGrammarsOptions .Builder ()
1485- .customizationId (customizationId )
1486- .build ();
1487-
1488- assertEquals (customizationId , listGrammarsOptions .customizationId ());
1489- }
1490-
14911527 @ Test
14921528 public void testListGrammars () throws InterruptedException {
14931529 server .enqueue (jsonResponse (grammars ));
@@ -1504,20 +1540,6 @@ public void testListGrammars() throws InterruptedException {
15041540 assertEquals (grammars , response );
15051541 }
15061542
1507- @ Test
1508- public void testGetGrammarOptions () {
1509- String customizationId = "id" ;
1510- String grammarName = "grammar_name" ;
1511-
1512- GetGrammarOptions getGrammarOptions = new GetGrammarOptions .Builder ()
1513- .customizationId (customizationId )
1514- .grammarName (grammarName )
1515- .build ();
1516-
1517- assertEquals (customizationId , getGrammarOptions .customizationId ());
1518- assertEquals (grammarName , getGrammarOptions .grammarName ());
1519- }
1520-
15211543 @ Test
15221544 public void testGetGrammar () throws InterruptedException {
15231545 server .enqueue (jsonResponse (grammar ));
@@ -1536,20 +1558,6 @@ public void testGetGrammar() throws InterruptedException {
15361558 assertEquals (grammar , response );
15371559 }
15381560
1539- @ Test
1540- public void testDeleteGrammarOptions () {
1541- String customizationId = "id" ;
1542- String grammarName = "grammar_name" ;
1543-
1544- DeleteGrammarOptions deleteGrammarOptions = new DeleteGrammarOptions .Builder ()
1545- .customizationId (customizationId )
1546- .grammarName (grammarName )
1547- .build ();
1548-
1549- assertEquals (customizationId , deleteGrammarOptions .customizationId ());
1550- assertEquals (grammarName , deleteGrammarOptions .grammarName ());
1551- }
1552-
15531561 @ Test
15541562 public void testDeleteGrammar () throws InterruptedException {
15551563 MockResponse desiredResponse = new MockResponse ().setResponseCode (200 );
@@ -1568,6 +1576,8 @@ public void testDeleteGrammar() throws InterruptedException {
15681576 assertEquals (DELETE , request .getMethod ());
15691577 }
15701578
1579+ // --- HELPERS ---
1580+
15711581 private static class TestRecognizeCallback implements RecognizeCallback {
15721582
15731583 private final BlockingQueue <SpeechRecognitionResults > speechResults = new LinkedBlockingQueue <>();
0 commit comments