Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:19:20+00:00 2026-06-13T11:19:20+00:00

I have a new Play 2 project with play-authenticate. I wrote some simple test

  • 0

I have a new Play 2 project with play-authenticate. I wrote some simple test cases for the REST API. Tests pass fine on the console but I cannot make some of them pass in Eclipse.

@Test
public void testWithoutAuth() {
  running(testServer(3333), new Runnable() {
    @Override
    public void run() {
        Response response = WS.url("http://localhost:3333/secretarea").get().get();
        assertThat(response.getStatus()).isEqualTo(FORBIDDEN);
    }
  });
}

This example passes fine on the console but in Eclipse fails with response error code 500. it looks like the application setup is not ok (e.g. my own AuthProvider not found). Has anyone managed to get such tests working in Eclipse?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:19:21+00:00Added an answer on June 13, 2026 at 11:19 am

    Finally sorted this out. The trick is to create FakeApplicatio with custom config. In my case the setup is like this:

    @Test
    public void testWithoutAuth() {
        List<String> plugins = new ArrayList<String>();
        plugins.add("be.objectify.deadbolt.DeadboltPlugin");
        plugins.add("service.MyUserServicePlugin");
        plugins.add("providers.MyUsernamePasswordAuthProvider");
    
        FakeApplication fa = fakeApplication(new HashMap<String,String>(), plugins);
    
        running(testServer(3333, fa), new Runnable() {
            @Override
            public void run() {
                Response response = WS.url("http://localhost:3333/secretarea").get().get();
                assertThat(response.getStatus()).isEqualTo(FORBIDDEN);
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my new macbook air. I have created one test application. now i
I have a new Codeblocks install with mingw32 compiler. Created new c++ console project
I need to play SWF files in my project. These SWF files have background
I have a directory /sdcard/audio in the project. This directory contains some audio (wav)
I am about to start a new project that will use the Play! 2
I am playing a bit with Play! 2.0.2. My project is new and the
I'm starting a new project to play the video on my LAN, actually if
So I am making a simple java project to play around with JDBC in
I'm new to clojure. I have a jar file I want to play with
I'm new to AS3 and I'm doing some custom video player video project for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.