Ejemplo n.º 1
0
  public void testPlayAndStopByEndOfAudio()
      throws IllegalStateException, IOException, InterruptedException {
    IAudioRecorder ar = new AudioRecorder(FILE);
    ar.startRecording();
    Thread.sleep(1000);
    ar.stopRecording();

    ar.startPlaying();
    Thread.sleep(2000);
    assertFalse(ar.isPlaying());
  }
Ejemplo n.º 2
0
 public void testRecordAndPlay() {
   try {
     IAudioRecorder ar = new AudioRecorder(FILE);
     ar.startRecording();
     assertTrue(ar.isRecording());
     Thread.sleep(2000);
     ar.stopRecording();
     ar.startPlaying();
     assertTrue(ar.isPlaying());
     Thread.sleep(2500);
     assertFalse(ar.isPlaying());
     ar.release();
   } catch (Exception e) {
     fail(e.getMessage());
   }
 }
Ejemplo n.º 3
0
 public void testRecording() {
   try {
     IAudioRecorder ar = new AudioRecorder(FILE);
     ar.startRecording();
     assertTrue(ar.isRecording());
     Thread.sleep(1000);
     ar.stopRecording();
     assertFalse(ar.isRecording());
     File f = new File(FILE);
     assertTrue(f.exists());
     assertTrue(f.length() > 1024);
     ar.release();
   } catch (Exception e) {
     fail(e.getMessage());
   }
 }
Ejemplo n.º 4
0
 public void testRecordRepeatedlyAndPlayEnd() {
   try {
     IAudioRecorder ar = new AudioRecorder(FILE);
     for (int i = 0; i < 3; i++) {
       ar.startRecording();
       assertTrue(ar.isRecording());
       Thread.sleep(2000);
       ar.stopRecording();
     }
     ar.startPlaying();
     assertTrue(ar.isPlaying());
     Thread.sleep(2500);
     assertFalse(ar.isPlaying());
     ar.release();
   } catch (Exception e) {
     fail(e.getMessage());
   }
 }