Commit a281795d authored by Shaun Burch's avatar Shaun Burch

#11 Add test logging to gradle

parent 0ed4f95e
Pipeline #22230863 passed with stages
in 12 minutes and 23 seconds
......@@ -23,6 +23,11 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
dependencies {
......
package com.example.exchangerates.api.fixer.io;
import io.reactivex.Single;
import retrofit2.http.GET;
/**
* Retrofit Interface for the Fixer.io exchange rates API.
* <p>
* Doc: https://fixer.io/documentation
*/
public interface FixerApi {
String VERSION = "/latest";
/**
* Get a list of exchange rates
*
* @return Call with list of exchange rates
*/
@GET("/api" + VERSION)
Single<FixerResponse> listRates();
}
package com.example.exchangerates.api.fixer.io;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by shaunburch on 3/19/18.
*/
public class FixerResponse implements Serializable {
private boolean success;
private long timestamp;
private String base;
private Date date;
private Map<String, Double> rates;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getBase() {
return base;
}
public void setBase(String base) {
this.base = base;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Map<String, Double> getRates() {
return rates;
}
public void setRates(Map<String, Double> rates) {
this.rates = rates;
}
public List<Rate> getRateList() {
ArrayList<Rate> rateList = new ArrayList<>();
for (Map.Entry<String, Double> entry : rates.entrySet()) {
rateList.add(new Rate(entry.getKey(), entry.getValue()));
}
return rateList;
}
@Override
public String toString() {
return "FixerResponse{" +
"success=" + success +
", timestamp=" + timestamp +
", base='" + base + '\'' +
", date=" + date +
", rates=" + rates +
'}';
}
}
package com.example.exchangerates.api.fixer.io;
import java.io.Serializable;
/**
* Created by shaunburch on 3/19/18.
*/
public class Rate implements Serializable {
private String symbol;
private double rate;
public Rate(String symbol, double rate) {
this.symbol = symbol;
this.rate = rate;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public double getRate() {
return rate;
}
public void setRate(double rate) {
this.rate = rate;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment