Hi, Did you add the .jars specific to the local dev server in the classpath of your IDE ?
regards didier On Mar 18, 12:27 am, James Andersen <[email protected]> wrote: > Apologize that this is a cross-post from a question I asked on > StackOverflow<http://stackoverflow.com/questions/5335966/junit-test-of-code-that-us...>yesterday... > just didn't realize this forum was available... > > I've got some code I'm deploying to Google App Engine - Java (GAE/J) that > makes use of theURLFetchService. I'd like to use JUnit to test this code. > Per the testing > documentation,<http://code.google.com/appengine/docs/java/tools/localunittesting.htm...> > it > appears I should have a test that uses their LocalURLFetchServiceTestConfig > class > ROUGHLY as follows: > > public class MyRemoteServiceTests { > private static final LocalURLFetchServiceTestConfig urlConfig = new > LocalURLFetchServiceTestConfig(); > private static final LocalServiceTestHelper helper = > new LocalServiceTestHelper(urlConfig); > > @Before > public void setUp() throws Exception { > service = new SampleService(); > helper.setUp(); > } > > @After > public void tearDown() throws Exception { > service = null; > helper.tearDown(); > } > > @Test > public void testThatCallsCodeThatUsesUrlFetch() { > Object data = service.getRemoteDataUsingUrlFetch("foo", "bar"); > Assert.assertNotNull(data); > } > > } > > I'm finding that this test continues to fail despite using the "helper" as > suggested in the GAE/J documentation on testing: "The API package 'urlfetch' > or call 'Fetch()' was not found.". > > I was assuming that using the "helper" would somehow setup the GAE > environment such that when I callURLFetchServiceFactory.getURLFetchService() > from within mygetRemoteDataUsingUrlFetch method, the interface returned would > be an instance ofLocalURLFetchService that would just "work" but that seems > NOT to be the case. > > - How can I test this code? > - Am I missing something? (I'm pretty new to GAE...) > - Do I have to refactor my getRemoteDataUsingUrlFetch so that it doesn't > useURLFetchServiceFactory.getURLFetchService() because that makes it > untestable locally??? (That sounds like it would really suck...) > > Any help/suggestions much appreciated! -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
