Questions tagged [spring-boot-test]

Spring Boot provides utilities and annotations to help when testing your application.

Spring Boot provides a @SpringBootTest annotation which can be used as an alternative to the standard spring-test @ContextConfiguration annotation when you need Spring Boot features. The annotation works by creating the ApplicationContext used in your tests via SpringApplication.

Utilities: ConfigFileApplicationContextInitializer,EnvironmentTestUtils,OutputCapture and TestRestTemplate

for example

EnvironmentTestUtils.addEnvironment(env, "org=Spring", "name=Boot");

Docs: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html

1399 questions
-2
votes
1 answer

Not able to add a java util collection to JsonObject

not able to put a any Java Util object to json object java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Map;)Lorg/json/JSONObject; while for below. was using org.json version 20170516 final List usersList =…
kapil das
  • 2,061
  • 1
  • 28
  • 29
-2
votes
1 answer

Cannot find why jUnit test return NullPointerException

I have simple Spring boot Rest application what returns Users list from database. Application works as expected but test scenario fail with error. After long googling cannot figure out why? It seems that test class cannot access userRepository and…
DD3
  • 25
  • 1
  • 3
-3
votes
1 answer

PowerMockito.mockStatic gives NoSuchMethodError error

Im using junit 4.12 powermock-module-junit4 - 1.6.1 powermock-api-mockito- 1.6.1 The error i'm getting is java.lang.NoSuchMethodError when trying to use mockStatic method
Rohan RM
  • 157
  • 1
  • 2
  • 10
-3
votes
2 answers

What is the best way to implement file upload using spring boot in AWS S3 bucket?

Working on Java Spring boot application(Web Service using web starter), I have requirement to store images in S3 bucket, Can someone suggest me how to implement? Hosting application in EC2 instance
1 2 3
93
94