Junit test run in Eclipse but fails with `gradle test` Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Override default Spring-Boot application.properties settings in Junit TestHow do you assert that a certain exception is thrown in JUnit 4 tests?JUnit and Spring configurationAdd context path to Spring Boot applicationSpring Boot application.properties value not populatingClasspath resource not found when running as jarOverride default Spring-Boot application.properties settings in Junit Test“Address already in use: bind” exception when running Gradle JUnit testsOverride default Spring-Boot application.properties settings in Junit Test with dynamic valuewhy properties from appliction.properties not available in Junit test in spring boot application?Unable to find a @SpringBootConfiguration when doing a JpaTest

Do any jurisdictions seriously consider reclassifying social media websites as publishers?

Crossing US/Canada Border for less than 24 hours

How to play a character with a disability or mental disorder without being offensive?

Disembodied hand growing fangs

Why is it faster to reheat something than it is to cook it?

Why is Nikon 1.4g better when Nikon 1.8g is sharper?

SF book about people trapped in a series of worlds they imagine

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode

I am having problem understanding the behavior of below code in JavaScript

Do wooden building fires get hotter than 600°C?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

How would a mousetrap for use in space work?

How fail-safe is nr as stop bytes?

Most bit efficient text communication method?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

How to write the following sign?

Morning, Afternoon, Night Kanji

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

What is the difference between globalisation and imperialism?

How do I find out the mythology and history of my Fortress?

How do living politicians protect their readily obtainable signatures from misuse?

An adverb for when you're not exaggerating



Junit test run in Eclipse but fails with `gradle test`



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Override default Spring-Boot application.properties settings in Junit TestHow do you assert that a certain exception is thrown in JUnit 4 tests?JUnit and Spring configurationAdd context path to Spring Boot applicationSpring Boot application.properties value not populatingClasspath resource not found when running as jarOverride default Spring-Boot application.properties settings in Junit Test“Address already in use: bind” exception when running Gradle JUnit testsOverride default Spring-Boot application.properties settings in Junit Test with dynamic valuewhy properties from appliction.properties not available in Junit test in spring boot application?Unable to find a @SpringBootConfiguration when doing a JpaTest



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm using Spring Boot 2 and I'm trying to do an integration test.
I configured a custom application.properties this way:



@TestPropertySource(
locations = "classpath:###/$$$/application-integrationtest.properties"
)
@ComponentScan(basePackages = "###.$$$" )


File is under src/test/java/###/$$$/application-integrationtest.properties



Running Junit under Eclipse works fine, but if I try gradle test, I get:




java.io.FileNotFoundException: class path resource
[###/$$$/application-integrationtest.properties] cannot be opened
because it does not exist




What's the deal?










share|improve this question

















  • 1





    properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

    – JB Nizet
    Mar 22 at 10:56


















0















I'm using Spring Boot 2 and I'm trying to do an integration test.
I configured a custom application.properties this way:



@TestPropertySource(
locations = "classpath:###/$$$/application-integrationtest.properties"
)
@ComponentScan(basePackages = "###.$$$" )


File is under src/test/java/###/$$$/application-integrationtest.properties



Running Junit under Eclipse works fine, but if I try gradle test, I get:




java.io.FileNotFoundException: class path resource
[###/$$$/application-integrationtest.properties] cannot be opened
because it does not exist




What's the deal?










share|improve this question

















  • 1





    properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

    – JB Nizet
    Mar 22 at 10:56














0












0








0








I'm using Spring Boot 2 and I'm trying to do an integration test.
I configured a custom application.properties this way:



@TestPropertySource(
locations = "classpath:###/$$$/application-integrationtest.properties"
)
@ComponentScan(basePackages = "###.$$$" )


File is under src/test/java/###/$$$/application-integrationtest.properties



Running Junit under Eclipse works fine, but if I try gradle test, I get:




java.io.FileNotFoundException: class path resource
[###/$$$/application-integrationtest.properties] cannot be opened
because it does not exist




What's the deal?










share|improve this question














I'm using Spring Boot 2 and I'm trying to do an integration test.
I configured a custom application.properties this way:



@TestPropertySource(
locations = "classpath:###/$$$/application-integrationtest.properties"
)
@ComponentScan(basePackages = "###.$$$" )


File is under src/test/java/###/$$$/application-integrationtest.properties



Running Junit under Eclipse works fine, but if I try gradle test, I get:




java.io.FileNotFoundException: class path resource
[###/$$$/application-integrationtest.properties] cannot be opened
because it does not exist




What's the deal?







java spring spring-boot testing integration-testing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 10:31









Marco SullaMarco Sulla

8,33362954




8,33362954







  • 1





    properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

    – JB Nizet
    Mar 22 at 10:56













  • 1





    properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

    – JB Nizet
    Mar 22 at 10:56








1




1





properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

– JB Nizet
Mar 22 at 10:56






properties files don't go to src/test/java. That's for java source files. They go to src/test/resources.

– JB Nizet
Mar 22 at 10:56













1 Answer
1






active

oldest

votes


















0














Ok, I put my property file under src/test/resources and added the folder to the build path in Eclipse.



PS: my previous answer was wrong. If I name the file application.properties, the default one has the precedence and it's loaded instead of the test one.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297676%2fjunit-test-run-in-eclipse-but-fails-with-gradle-test%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Ok, I put my property file under src/test/resources and added the folder to the build path in Eclipse.



    PS: my previous answer was wrong. If I name the file application.properties, the default one has the precedence and it's loaded instead of the test one.






    share|improve this answer





























      0














      Ok, I put my property file under src/test/resources and added the folder to the build path in Eclipse.



      PS: my previous answer was wrong. If I name the file application.properties, the default one has the precedence and it's loaded instead of the test one.






      share|improve this answer



























        0












        0








        0







        Ok, I put my property file under src/test/resources and added the folder to the build path in Eclipse.



        PS: my previous answer was wrong. If I name the file application.properties, the default one has the precedence and it's loaded instead of the test one.






        share|improve this answer















        Ok, I put my property file under src/test/resources and added the folder to the build path in Eclipse.



        PS: my previous answer was wrong. If I name the file application.properties, the default one has the precedence and it's loaded instead of the test one.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 25 at 11:24

























        answered Mar 22 at 18:13









        Marco SullaMarco Sulla

        8,33362954




        8,33362954





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297676%2fjunit-test-run-in-eclipse-but-fails-with-gradle-test%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript