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;
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
add a comment |
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
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
add a comment |
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
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
java spring spring-boot testing integration-testing
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
edited Mar 25 at 11:24
answered Mar 22 at 18:13
Marco SullaMarco Sulla
8,33362954
8,33362954
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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