Skip to content

Commit 045cdd8

Browse files
committed
Tests with jsonExtendedData implemented
1 parent e7fa820 commit 045cdd8

File tree

3 files changed

+215
-9
lines changed

3 files changed

+215
-9
lines changed

gradle/jackson-mapper-asl-1.0.0.jar

Whitespace-only changes.

src/main/java/com/smartcanvas/model/Card.java

Lines changed: 205 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
public class Card extends GenericData {
1616

17+
public void setJsonExtendedData(Object jsonExtendedData) {
18+
this.jsonExtendedData = jsonExtendedData;
19+
}
20+
1721
public enum CardStatus {
1822
// (any|approved|pending|expired|rejected)
1923
ANY, APPROVED, PENDING, EXPIRED, REJECTED;
@@ -53,7 +57,7 @@ public enum CardStatus {
5357
@Key
5458
private DateTime updateDate;
5559
@Key
56-
private GenericData jsonExtendedData;
60+
private Object jsonExtendedData;
5761

5862
private String coordinates;
5963

@@ -581,4 +585,204 @@ public String toString() {
581585
}
582586

583587
}
588+
589+
public static class MyData {
590+
591+
@Key
592+
private
593+
String name;
594+
@Key
595+
private
596+
String address;
597+
@Key
598+
private
599+
String country;
600+
@Key
601+
private
602+
String website;
603+
@Key
604+
private
605+
String phone;
606+
@Key
607+
private
608+
String logoImgUrl;
609+
@Key
610+
private
611+
String contactName;
612+
@Key
613+
private
614+
String contactJobTitle;
615+
@Key
616+
private
617+
String businessDescription;
618+
@Key
619+
private
620+
String memberOf;
621+
@Key
622+
private
623+
String certifications;
624+
@Key
625+
private
626+
String yearOfEstablishment;
627+
@Key
628+
Integer percBusinessOwnedByWomen;
629+
@Key
630+
Boolean isManagedControledByWomen;
631+
@Key
632+
Integer numPermEmployee;
633+
@Key
634+
Integer numFemaleEmployee;
635+
636+
637+
638+
public MyData(String name, String address, String country, String website, String phone, String logoImgUrl,
639+
String contactName, String contactJobTitle, String businessDescription, String memberOf,
640+
String certifications, String yearOfEstablishment, Integer percBusinessOwnedByWomen,
641+
Boolean isManagedControledByWomen, Integer numPermEmployee, Integer numFemaleEmployee) {
642+
this.setName(name);
643+
this.setAddress(address);
644+
this.setCountry(country);
645+
this.setWebsite(website);
646+
this.setPhone(phone);
647+
this.setLogoImgUrl(logoImgUrl);
648+
this.setContactName(contactName);
649+
this.setContactJobTitle(contactJobTitle);
650+
this.setBusinessDescription(businessDescription);
651+
this.setMemberOf(memberOf);
652+
this.setCertifications(certifications);
653+
this.setYearOfEstablishment(yearOfEstablishment);
654+
this.percBusinessOwnedByWomen = percBusinessOwnedByWomen;
655+
this.isManagedControledByWomen = isManagedControledByWomen;
656+
this.numPermEmployee =numPermEmployee ;
657+
this.numFemaleEmployee =numFemaleEmployee ;
658+
659+
660+
}
661+
662+
663+
664+
665+
666+
public String getName() {
667+
return name;
668+
}
669+
670+
public void setName(String name) {
671+
this.name = name;
672+
}
673+
674+
public String getAddress() {
675+
return address;
676+
}
677+
678+
public void setAddress(String address) {
679+
this.address = address;
680+
}
681+
682+
public String getCountry() {
683+
return country;
684+
}
685+
686+
public void setCountry(String country) {
687+
this.country = country;
688+
}
689+
690+
public String getWebsite() {
691+
return website;
692+
}
693+
694+
public void setWebsite(String website) {
695+
this.website = website;
696+
}
697+
698+
public String getPhone() {
699+
return phone;
700+
}
701+
702+
public void setPhone(String phone) {
703+
this.phone = phone;
704+
}
705+
706+
public String getLogoImgUrl() {
707+
return logoImgUrl;
708+
}
709+
710+
public void setLogoImgUrl(String logoImgUrl) {
711+
this.logoImgUrl = logoImgUrl;
712+
}
713+
714+
public String getContactName() {
715+
return contactName;
716+
}
717+
718+
public void setContactName(String contactName) {
719+
this.contactName = contactName;
720+
}
721+
722+
public String getContactJobTitle() {
723+
return contactJobTitle;
724+
}
725+
726+
public void setContactJobTitle(String contactJobTitle) {
727+
this.contactJobTitle = contactJobTitle;
728+
}
729+
730+
public String getBusinessDescription() {
731+
return businessDescription;
732+
}
733+
734+
public void setBusinessDescription(String businessDescription) {
735+
this.businessDescription = businessDescription;
736+
}
737+
738+
public String getMemberOf() {
739+
return memberOf;
740+
}
741+
742+
public void setMemberOf(String memberOf) {
743+
this.memberOf = memberOf;
744+
}
745+
746+
public String getCertifications() {
747+
return certifications;
748+
}
749+
750+
public void setCertifications(String certifications) {
751+
this.certifications = certifications;
752+
}
753+
754+
public String getYearOfEstablishment() {
755+
return yearOfEstablishment;
756+
}
757+
758+
public void setYearOfEstablishment(String yearOfEstablishment) {
759+
this.yearOfEstablishment = yearOfEstablishment;
760+
}
761+
762+
763+
@Override
764+
public String toString() {
765+
return Objects.toStringHelper(this)
766+
.add("name", this.getName())
767+
.add("address", this.getAddress())
768+
.add("address", this.getCountry())
769+
.add("address", this.getWebsite())
770+
.add("address", this.getPhone())
771+
.add("address", this.getLogoImgUrl())
772+
.add("address", this.getContactName())
773+
.add("address", this.getContactJobTitle())
774+
.add("address", this.getBusinessDescription())
775+
.add("address", this.getMemberOf())
776+
.add("address", this.getCertifications())
777+
.add("address", this.getYearOfEstablishment())
778+
.add("address", this.percBusinessOwnedByWomen)
779+
.add("address", this.isManagedControledByWomen)
780+
.add("address", this.numPermEmployee)
781+
.add("address", this.numFemaleEmployee)
782+
.toString();
783+
}
784+
}
785+
786+
787+
584788
}

src/test/java/com/smartcanvas/CardCreationIntegrationTests.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package com.smartcanvas;
22

3-
import static org.junit.Assert.assertNotNull;
4-
import static org.junit.Assert.assertNotEquals;
5-
6-
import java.io.IOException;
7-
8-
import org.jose4j.lang.JoseException;
9-
import org.junit.Test;
10-
113
import com.google.api.client.util.DateTime;
124
import com.smartcanvas.model.Card;
135
import com.smartcanvas.model.Card.Author;
146
import com.smartcanvas.model.Card.Community;
157
import com.smartcanvas.model.Card.ContentProvider;
168
import com.smartcanvas.model.CardId;
9+
import com.smartcanvas.model.*;
10+
import org.jose4j.lang.JoseException;
11+
import org.junit.Test;
12+
13+
import java.io.IOException;
14+
15+
import static org.junit.Assert.assertNotNull;
1716

1817
public class CardCreationIntegrationTests extends AbstractSmartCanvasIntegrationTests {
1918

@@ -83,10 +82,13 @@ public void addCommunity() throws IOException {
8382
comunities.setDisplayName("JEDI GROUP");
8483
comunities.setId("Community");
8584
card.setCommunity(comunities);
85+
card.setJsonExtendedData(new Card.MyData("Test Company", "Campinas", "Brasil", "www.google.com", "123124", "http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg ", "Test User", "CEO", "This is a test company", "UN", "ISO9002", "1 July, 2015", 100, true, 2, 2 ));
8686

8787
smartcanvas.cards().insert(card);
8888
}
8989

90+
91+
9092
@Test
9193
public void addDateTime() throws IOException {
9294
Card card = new Card(givenProvider());

0 commit comments

Comments
 (0)