Recognito { public synchronized VoicePrint createVoicePrint(K userKey, double[] voiceSample) { if(userKey == null) { throw new NullPointerException("The userKey is null"); } if(store.containsKey(userKey)) { throw new IllegalArgumentException("The userKey already exists: [" + userKey + "]"); } double[] features = extractFeatures(voiceSample, sampleRate); VoicePrint voicePrint = new VoicePrint(features); synchronized (this) { if (!universalModelWasSetByUser.get()) { if (universalModel == null) { universalModel = new VoicePrint(voicePrint); } else { universalModel.merge(features); } } } store.put(userKey, voicePrint); return voicePrint; } Recognito(float sampleRate);  Recognito(float sampleRate, Map<K, VoicePrint> voicePrintsByUserKey); VoicePrint getUniversalModel(); synchronized void setUniversalModel(VoicePrint universalModel); synchronized VoicePrint createVoicePrint(K userKey, double[] voiceSample); VoicePrint createVoicePrint(K userKey, File voiceSampleFile); VoicePrint mergeVoiceSample(K userKey, double[] voiceSample); VoicePrint mergeVoiceSample(K userKey, File voiceSampleFile); List<MatchResult<K>> identify(double[] voiceSample); List<MatchResult<K>> identify(File voiceSampleFile);  }
@Test(expected = NullPointerException.class) public void createVoicePrintThrowsNullPointerExceptionWhenTheUserKeyIsNull() { recognito.createVoicePrint(null, voiceSample); }
@Test public void createVoicePrintReturnsVoicePrint() { VoicePrint voicePrint = recognito.createVoicePrint("duh", voiceSample); assertNotNull(voicePrint); }