Skip to content

Commit

Permalink
bump versions of used libs
Browse files Browse the repository at this point in the history
  • Loading branch information
stritti committed Jul 4, 2019
1 parent 20c688f commit 0984aed
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
13 changes: 6 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ configurations {

dependencies {
compile group: 'com.mashape.unirest', name: 'unirest-java', version:'1.4.9'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.5.3'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.5.9'
compile group: 'org.json', name: 'json', version:'20160810'
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.0'
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.5'
compile group: 'commons-beanutils', name: 'commons-beanutils', version:'1.9.3'
compile group: 'commons-io', name: 'commons-io', version:'2.5'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.25'
compile group: 'commons-io', name: 'commons-io', version:'2.6'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.26'

testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'commons-io', name: 'commons-io', version:'2.5'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.8.0'
testCompile group: 'org.slf4j', name: 'slf4j-jdk14', version:'1.7.25'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version:'2.23.2'
testCompile group: 'org.slf4j', name: 'slf4j-jdk14', version:'1.7.26'

codacy group: 'com.codacy', name: 'codacy-coverage-reporter', version: '1.0.13'
}
Expand Down
72 changes: 36 additions & 36 deletions src/test/java/com/sybit/airtable/CustomObjectMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import com.sybit.airtable.vo.Attachment;
import com.sybit.airtable.vo.Thumbnail;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.map.HashedMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Before;
Expand All @@ -25,94 +25,94 @@
* @author fzr
*/
public class CustomObjectMapperTest {

private ListConverter listConverter;
private MapConverter mapConverter;

@Before
public void before(){

this.listConverter = new ListConverter();
this.mapConverter = new MapConverter();

}

@Test
public void listClassTest(){

listConverter.setListClass(Attachment.class);
assertEquals(listConverter.getListClass(),Attachment.class);
assertEquals(listConverter.getListClass(),Attachment.class);
}
@Test

@Test
public void mapClassTest(){

mapConverter.setMapClass(Thumbnail.class);
assertEquals(mapConverter.getMapClass(),Thumbnail.class);
}

@Test
public void convertListTest(){

listConverter.setListClass(Attachment.class);

Class type = List.class;
List value = new ArrayList();

LinkedTreeMap ltm = new LinkedTreeMap();
ltm.put("id","id0001");
ltm.put("url","http://test.com");
ltm.put("filename","filename.txt");
ltm.put("size","10");
ltm.put("type","image/jpeg");
Map<String,Thumbnail> thumbnails = new HashedMap<>();

Map<String,Thumbnail> thumbnails = new HashMap<>();
Thumbnail tmb = new Thumbnail();

tmb.setName("Thumbnail");
tmb.setUrl("http:example.com");
tmb.setWidth(Float.valueOf(10));
tmb.setHeight(Float.valueOf(10));

thumbnails.put("small", tmb);

ltm.put("thumbnails",thumbnails);

value.add(0, ltm);

List<Attachment> list = (List<Attachment>) listConverter.convert(type, value);
assertNotNull(list);
assertNotNull(list.get(0).getId());
assertNotNull(list.get(0).getFilename());
assertNotNull(list.get(0).getSize());
assertNotNull(list.get(0).getType());
assertNotNull(list.get(0).getUrl());
assertNotNull(list.get(0).getThumbnails());
assertNotNull(list.get(0).getThumbnails());

}

@Test
public void convertMapTest(){

mapConverter.setMapClass(Thumbnail.class);

Class type = Map.class;

LinkedTreeMap<String, Object> value = new LinkedTreeMap<>();
LinkedTreeMap<String, Object> innerMap = new LinkedTreeMap<>();

innerMap.put("url","http://example.com");
value.put("small",innerMap);
value.put("small",innerMap);


Map<String,Thumbnail> thumb = (Map<String,Thumbnail>) mapConverter.convert(type,value);
System.out.println(thumb);
assertNotNull(thumb);
assertNotNull(thumb.get("small"));
assertNotNull(thumb.get("small").getUrl());



}

}

0 comments on commit 0984aed

Please sign in to comment.