PageRenderTime 806ms CodeModel.GetById 523ms app.highlight 2ms RepoModel.GetById 280ms app.codeStats 0ms

/src/test/java/com/google/ie/test/ServiceTest.java

http://thoughtsite.googlecode.com/
Java | 38 lines | 19 code | 8 blank | 11 comment | 0 complexity | 95dccb35c7df0ba020f7da89a334b832 MD5 | raw file
 1// Copyright 2009 Google Inc. All Rights Reserved.
 2
 3package com.google.ie.test;
 4
 5import com.google.appengine.tools.development.ApiProxyLocalImpl;
 6import com.google.apphosting.api.ApiProxy;
 7
 8import org.junit.After;
 9import org.junit.Before;
10
11import java.io.File;
12
13/**
14 * Base class for testing all non transactional service classes. The setUp() and
15 * tearDown() methods defined below are responsible for creating and resetting
16 * the test environment.
17 * 
18 * @author asirohi
19 * 
20 */
21public class ServiceTest {
22
23    @Before
24    public void setUp() {
25        // Set environment as test environment
26        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
27        ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")) {
28        });
29    }
30
31    @After
32    public void tearDown() {
33        // Setting api proxy to null. Not necessary but a good practice.
34        ApiProxy.setDelegate(null);
35        ApiProxy.setEnvironmentForCurrentThread(null);
36    }
37
38}