Recognito { public VoicePrint mergeVoiceSample(K userKey, double[] voiceSample) { if(userKey == null) { throw new NullPointerException("The userKey is null"); } VoicePrint original = store.get(userKey); if(original == null) { throw new IllegalArgumentException("No voice print linked to this user key [" + userKey + "]"); } double[] features = extractFeatures(voiceSample, sampleRate); synchronized (this) { if(!universalModelWasSetByUser.get()) { universalModel.merge(features); } } original.merge(features); return original; } 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 mergeVoiceSampleThrowsNullPointerExceptionWhenTheUserKeyIsNull() { recognito.mergeVoiceSample(null, voiceSample); }
@Test(expected = IllegalArgumentException.class) public void mergeVoiceSampleThrowsIllegalArgumentExceptionWhenTheUserKeyIsUnknown() { recognito.mergeVoiceSample("duh", voiceSample); }