DatastoreのJUnit4 TestCaseで、APIやらThreadやらエラーが出る場合

結論は、AppEngineTestCase を継承してないTestCaseだったから。

通常、build.xmlから生成したserviceは、次のようにAppEngineTestCase を継承している。

package tutorial.service;

import org.slim3.tester.AppEngineTestCase;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

public class BasicInfoServiceTest extends AppEngineTestCase {

    private BasicInfoService service = new BasicInfoService();

    @Test
    public void test() throws Exception {
        assertThat(service, is(notNullValue()));
    }
}

これが無いだけで、APIがこのThreadにないよ的(適当。元のメッセージを忘れたため)なエラーメッセージが出てた。