File tree 4 files changed +86
-0
lines changed
4 files changed +86
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 0.2
2
+
3
+ phases :
4
+ install :
5
+ runtime-versions :
6
+ java : corretto11
7
+ pre_build :
8
+ commands :
9
+ - echo Nothing to do in the pre_build phase...
10
+ build :
11
+ commands :
12
+ - echo Build started on `date`
13
+ - mvn install
14
+ post_build :
15
+ commands :
16
+ - echo Build completed on `date`
17
+ artifacts :
18
+ files :
19
+ - target/messageUtil-1.0.jar
Original file line number Diff line number Diff line change
1
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
2
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
4
+ <modelVersion >4.0.0</modelVersion >
5
+ <groupId >org.example</groupId >
6
+ <artifactId >messageUtil</artifactId >
7
+ <version >1.0</version >
8
+ <packaging >jar</packaging >
9
+ <name >Message Utility Java Sample App</name >
10
+ <dependencies >
11
+ <dependency >
12
+ <groupId >junit</groupId >
13
+ <artifactId >junit</artifactId >
14
+ <version >4.11</version >
15
+ <scope >test</scope >
16
+ </dependency >
17
+ </dependencies >
18
+ <build >
19
+ <plugins >
20
+ <plugin >
21
+ <groupId >org.apache.maven.plugins</groupId >
22
+ <artifactId >maven-compiler-plugin</artifactId >
23
+ <version >3.8.0</version >
24
+ </plugin >
25
+ </plugins >
26
+ </build >
27
+ </project >
Original file line number Diff line number Diff line change
1
+ public class MessageUtil {
2
+ private String message ;
3
+
4
+ public MessageUtil (String message ) {
5
+ this .message = message ;
6
+ }
7
+
8
+ public String printMessage () {
9
+ System .out .println (message );
10
+ return message ;
11
+ }
12
+
13
+ public String salutationMessage () {
14
+ message = "Hi!" + message ;
15
+ System .out .println (message );
16
+ return message ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ import org .junit .Test ;
2
+ import org .junit .Ignore ;
3
+ import static org .junit .Assert .assertEquals ;
4
+
5
+ public class TestMessageUtil {
6
+
7
+ String message = "Robert" ;
8
+ MessageUtil messageUtil = new MessageUtil (message );
9
+
10
+ @ Test
11
+ public void testPrintMessage () {
12
+ System .out .println ("Inside testPrintMessage()" );
13
+ assertEquals (message ,messageUtil .printMessage ());
14
+ }
15
+
16
+ @ Test
17
+ public void testSalutationMessage () {
18
+ System .out .println ("Inside testSalutationMessage()" );
19
+ message = "Hi!" + "Robert" ;
20
+ assertEquals (message ,messageUtil .salutationMessage ());
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments