Skip to content

Commit 0390bac

Browse files
Merge pull request #10 from yashwanttejwani/unit-test
Unit Testing
2 parents 81b4c27 + 2f9c2f1 commit 0390bac

13 files changed

Lines changed: 145 additions & 9 deletions

message-rosa.iml

Lines changed: 0 additions & 2 deletions
This file was deleted.

pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.3.0.RELEASE</version>
8+
<version>2.5.7</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.uci</groupId>
@@ -18,6 +18,10 @@
1818
</properties>
1919

2020
<dependencies>
21+
<dependency>
22+
<groupId>org.springframework.boot</groupId>
23+
<artifactId>spring-boot-starter-validation</artifactId>
24+
</dependency>
2125
<dependency>
2226
<groupId>org.projectlombok</groupId>
2327
<artifactId>lombok</artifactId>
@@ -51,7 +55,6 @@
5155
<dependency>
5256
<groupId>org.junit.jupiter</groupId>
5357
<artifactId>junit-jupiter-api</artifactId>
54-
<version>5.6.2</version>
5558
<scope>test</scope>
5659
</dependency>
5760
<dependency>
@@ -70,7 +73,7 @@
7073
<plugin>
7174
<groupId>org.apache.maven.plugins</groupId>
7275
<artifactId>maven-shade-plugin</artifactId>
73-
<version>2.3</version>
76+
<version>3.2.4</version>
7477
<executions>
7578
<!-- Run shade goal on package phase -->
7679
<execution>

src/main/java/messagerosa/core/model/ButtonChoice.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
public class ButtonChoice {
1111
private String key;
1212
private String text;
13+
private Boolean backmenu;
1314
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package messagerosa.core.model;
2+
3+
public enum DeviceType {
4+
PHONE("phone");
5+
6+
private String name;
7+
8+
DeviceType(String deviceType) {
9+
name=deviceType;
10+
}
11+
12+
public String toString(){
13+
return name;
14+
}
15+
16+
public static String getEnumByString(String code){
17+
for(DeviceType e : DeviceType.values()){
18+
if(e.name.equals(code)) return e.name();
19+
}
20+
return null;
21+
}
22+
}

src/main/java/messagerosa/core/model/LocationParams.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
public class LocationParams {
1313
private double longitude;
1414
private double latitude;
15+
private String address;
16+
private String url;
17+
private String name;
1518
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package messagerosa.core.model;
2+
3+
public enum MediaCategory {
4+
IMAGE("image"),
5+
AUDIO("audio"),
6+
VIDEO("video"),
7+
VOICE("voice"),
8+
FILE("file");
9+
10+
private String name;
11+
12+
MediaCategory(String mediaCategory) {
13+
name=mediaCategory;
14+
}
15+
16+
public String toString(){
17+
return name;
18+
}
19+
20+
public static String getEnumByString(String code){
21+
for(MediaCategory e : MediaCategory.values()){
22+
if(e.name.equals(code)) return e.name();
23+
}
24+
return null;
25+
}
26+
}

src/main/java/messagerosa/core/model/MessageMedia.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
@NoArgsConstructor
1111
@AllArgsConstructor
1212
public class MessageMedia {
13-
private String category; //category list {image, audio, document, video}
13+
private MediaCategory category; //category list {image, audio, document, video}
1414
private String text; //caption, if applicable
1515
private String url;
16+
private MessageMediaError messageMediaError;
17+
private Double size;
1618
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package messagerosa.core.model;
2+
3+
public enum MessageMediaError {
4+
PAYLOAD_TO_LARGE("payloadTooLarge"),
5+
EMPTY_RESPONSE("emptyResponse");
6+
private String name;
7+
8+
MessageMediaError(String name) {
9+
this.name = name;
10+
}
11+
12+
@Override
13+
public String toString() {return name;}
14+
15+
public static MessageMediaError getErrorByText(String text){
16+
for (MessageMediaError e : MessageMediaError.values()){
17+
if(e.name.equals(text))
18+
return e;
19+
}
20+
return null;
21+
}
22+
}
23+

src/main/java/messagerosa/core/model/SenderReceiverInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
public class SenderReceiverInfo {
1919

2020
// persist
21-
private String userID;
22-
21+
private String userID; //PhoneNo
2322
private ArrayList<String> groups;
24-
2523
private String campaignID;
2624
private String formID;
2725
private boolean bot;
2826
private boolean broadcast;
2927
private Map<String, String> meta;
28+
private DeviceType deviceType;
29+
private String deviceID; //UUID
30+
private String encryptedDeviceID; //Encrypted Device String
3031
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package messagerosa.core.model;
2+
3+
public enum StylingTag {
4+
LIST("list"),
5+
QUICKREPLYBTN("buttonsForListItems"),
6+
IMAGE("image"),
7+
AUDIO("audio"),
8+
VIDEO("video"),
9+
DOCUMENT("document");
10+
11+
private String name;
12+
13+
StylingTag(String stylingTag) {
14+
name=stylingTag;
15+
}
16+
17+
public String toString() {
18+
return name;
19+
}
20+
21+
public static StylingTag getEnumByText(String code) {
22+
for (StylingTag e : StylingTag.values()) {
23+
if (e.name.equals(code))
24+
return e;
25+
}
26+
return null;
27+
}
28+
}

0 commit comments

Comments
 (0)