1 15 package org.apache.hivemind.impl; 16 17 import java.util.Collections ; 18 import java.util.List ; 19 20 import org.apache.hivemind.ApplicationRuntimeException; 21 import org.apache.hivemind.ErrorHandler; 22 import org.apache.hivemind.test.HiveMindTestCase; 23 24 29 public class TestTranslatorManager extends HiveMindTestCase 30 { 31 public void testNoClassOrService() 32 { 33 TranslatorContribution tc = new TranslatorContribution(); 34 tc.setName("invalid"); 35 36 List l = Collections.singletonList(tc); 37 38 ErrorHandler eh = (ErrorHandler) newMock(ErrorHandler.class); 39 40 eh 41 .error( 42 TranslatorManagerImpl.LOG, 43 "Translator contribution 'invalid' must specify either the service-id or class attribute.", 44 null, 45 null); 46 47 replayControls(); 48 49 TranslatorManagerImpl tm = new TranslatorManagerImpl(l, eh); 50 51 try 52 { 53 tm.getTranslator("invalid"); 54 unreachable(); 55 } 56 catch (ApplicationRuntimeException ex) 57 { 58 assertExceptionSubstring( 59 ex, 60 "No translator named 'invalid' has been registered in configuration point hivemind.Translators."); 61 } 62 63 verifyControls(); 64 } 65 } | Popular Tags |