File tree 3 files changed +63
-1
lines changed
main/java/org/gluecoders/library
test/java/org/gluecoders/library
3 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 7
7
<groupId >org.gluecoders.guides</groupId >
8
8
<artifactId >springboot-guide</artifactId >
9
9
<version >1.0-SNAPSHOT</version >
10
-
10
+ < packaging >jar</ packaging >
11
11
<properties >
12
12
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
13
13
<project .reporting.outputEncoding>UTF-8</project .reporting.outputEncoding>
23
23
<version >${spring.version} </version >
24
24
<type >pom</type >
25
25
</dependency >
26
+ <dependency >
27
+ <groupId >org.springframework.boot</groupId >
28
+ <artifactId >spring-boot-starter-web</artifactId >
29
+ <version >${spring.version} </version >
30
+ </dependency >
31
+ <dependency >
32
+ <groupId >org.springframework.boot</groupId >
33
+ <artifactId >spring-boot-starter-test</artifactId >
34
+ <version >${spring.version} </version >
35
+ </dependency >
26
36
</dependencies >
27
37
28
38
<build >
Original file line number Diff line number Diff line change
1
+ package org .gluecoders .library ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .web .bind .annotation .GetMapping ;
6
+ import org .springframework .web .bind .annotation .RequestMapping ;
7
+ import org .springframework .web .bind .annotation .RestController ;
8
+
9
+ /**
10
+ * Created by Anand_Rajneesh on 6/10/2017.
11
+ */
12
+ @ SpringBootApplication
13
+ @ RestController
14
+ public class Application {
15
+
16
+ public static void main (String [] args ) {
17
+ SpringApplication .run (Application .class , args );
18
+ }
19
+
20
+ @ RequestMapping ("/" )
21
+ @ GetMapping
22
+ public String hello (){
23
+ return "Hi ! Welcome to Spring Boot Guide" ;
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package org .gluecoders .library ;
2
+
3
+ import org .junit .Test ;
4
+ import org .junit .runner .RunWith ;
5
+ import org .springframework .beans .factory .annotation .Autowired ;
6
+ import org .springframework .boot .test .autoconfigure .web .servlet .WebMvcTest ;
7
+ import org .springframework .test .context .junit4 .SpringRunner ;
8
+ import org .springframework .test .web .servlet .MockMvc ;
9
+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .*;
10
+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .*;
11
+ /**
12
+ * Created by Anand_Rajneesh on 6/10/2017.
13
+ */
14
+ @ RunWith (SpringRunner .class )
15
+ @ WebMvcTest (Application .class )
16
+ public class ApplicationTest {
17
+
18
+ @ Autowired
19
+ private MockMvc mvc ;
20
+
21
+ @ Test
22
+ public void testHello () throws Exception {
23
+ mvc .perform (get ("/" ))
24
+ .andExpect (status ().isOk ())
25
+ .andExpect (content ().string ("Hi ! Welcome to Spring Boot Guide" ));
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments