// Path: libs/core/src/test/java/com/africastalking/test/Fixtures.java
// public final class Fixtures {
//     public static String API_KEY;
//     public static String USERNAME;
//     public static final boolean DEBUG = true;
//     public static final long TIMEOUT = 3500;
// 
//     static {
//         try {
//             String filePath = "../../local.properties"; // relative to libs/core
//             Properties properties = new Properties();
//             FileInputStream is = new FileInputStream(filePath);
//             properties.load(is);
//             API_KEY = properties.getProperty("api.key");
//             USERNAME = properties.getProperty("api.username");
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/CallResponse.java
// public final class CallResponse {
//     public String status;
//     public String phoneNumber;
//     public String errorMessage;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/QueuedCallsResponse.java
// public final class QueuedCallsResponse {
//     public String phoneNumber;
//     public String queueName;
//     public int numCalls;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/action/GetDigits.java
// public class GetDigits extends Action {
// 
//     /**
//      * Get Digits
//      * @param say
//      * @param numDigits
//      * @param finishOnKey
//      * @param callbackUrl
//      */
//     public GetDigits(Say say, int numDigits, String finishOnKey, URL callbackUrl) {
//         init(say, numDigits, finishOnKey, callbackUrl);
//     }
// 
//     public GetDigits(Say say) {
//         init(say, 0, null, null);
//     }
// 
// 
//     /**
//      * Get Digits
//      * @param play
//      * @param numDigits
//      * @param finishOnKey
//      * @param callbackUrl
//      */
//     public GetDigits(Play play, int numDigits, String finishOnKey, URL callbackUrl) {
//         init(play, numDigits, finishOnKey, callbackUrl);
//     }
// 
//     public GetDigits(Play play) {
//         init(play, 0, null, null);
//     }
// 
//     private void init(Action child, int numDigits, String finishOnKey, URL callbackUrl) {
//         this.tag = "GetDigits";
// 
//         if (numDigits > 0) {
//             this.attributes.put("numDigits", String.valueOf(numDigits));
//         }
// 
//         if (finishOnKey != null) {
//             this.attributes.put("finishOnKey", finishOnKey);
//         }
// 
//         if (callbackUrl != null) {
//             this.attributes.put("callbackUrl", callbackUrl.toString());
//         }
// 
//         this.children.add(child);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/action/Say.java
// public class Say extends Action {
// 
//     public enum Voice { MAN, WOMAN }
// 
//     /**
//      * Say
//      * @param text
//      * @param playBeep
//      * @param voice
//      */
//     public Say(String text, boolean playBeep, Voice voice) {
//         this.tag = "Say";
//         this.text = text;
// 
//         if (playBeep) {
//             this.attributes.put("playBeep", "true");
//         }
// 
//         if (voice != null) {
//             this.attributes.put("voice", voice.name().toLowerCase());
//         }
//     }
// 
//     public Say(String text) {
//         this(text, false, null);
//     }
// 
//     public Say(String text, Voice voice) {
//         this(text, false, voice);
//     }
// 
//     public Say(String text, boolean playBeep) {
//         this(text, playBeep, null);
//     }
// 
// }


import com.africastalking.*;
import com.africastalking.test.Fixtures;
import com.africastalking.voice.CallResponse;
import com.africastalking.voice.QueuedCallsResponse;
import com.africastalking.voice.action.GetDigits;
import com.africastalking.voice.action.Record;
import com.africastalking.voice.action.Say;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
    }

    @Test
    public void testUploadMediaFile() {
        VoiceService service = AfricasTalking.getService(VoiceService.class);
        try {
            final String response = service.uploadMediaFile("+254718769889", "http://defef.klo/wave.mp3");
            Assert.assertNotNull(response);
        } catch (IOException e) {
            Assert.fail(e.getMessage());
        }
    }

    @Test
    public void testXmlBuilder() {
        ActionBuilder builder = new ActionBuilder();

        String say = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Say voice=\"man\">Your balance is 1234 Shillings</Say></Response>";
        Assert.assertEquals(say, builder.say(new Say("Your balance is 1234 Shillings", false, Say.Voice.MAN)).build());

        builder = new ActionBuilder();

        String getDigits  = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<Response>" +
                "<GetDigits finishOnKey=\"#\">" +
                "<Say>Please enter your account number followed by the hash sign</Say>" +
                "</GetDigits>" +
                "<Record/>" +
                "</Response>";
        String getDigitsTest = builder
// Path: libs/core/src/test/java/com/africastalking/test/Fixtures.java
// public final class Fixtures {
//     public static String API_KEY;
//     public static String USERNAME;
//     public static final boolean DEBUG = true;
//     public static final long TIMEOUT = 3500;
// 
//     static {
//         try {
//             String filePath = "../../local.properties"; // relative to libs/core
//             Properties properties = new Properties();
//             FileInputStream is = new FileInputStream(filePath);
//             properties.load(is);
//             API_KEY = properties.getProperty("api.key");
//             USERNAME = properties.getProperty("api.username");
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/CallResponse.java
// public final class CallResponse {
//     public String status;
//     public String phoneNumber;
//     public String errorMessage;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/QueuedCallsResponse.java
// public final class QueuedCallsResponse {
//     public String phoneNumber;
//     public String queueName;
//     public int numCalls;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/action/GetDigits.java
// public class GetDigits extends Action {
// 
//     /**
//      * Get Digits
//      * @param say
//      * @param numDigits
//      * @param finishOnKey
//      * @param callbackUrl
//      */
//     public GetDigits(Say say, int numDigits, String finishOnKey, URL callbackUrl) {
//         init(say, numDigits, finishOnKey, callbackUrl);
//     }
// 
//     public GetDigits(Say say) {
//         init(say, 0, null, null);
//     }
// 
// 
//     /**
//      * Get Digits
//      * @param play
//      * @param numDigits
//      * @param finishOnKey
//      * @param callbackUrl
//      */
//     public GetDigits(Play play, int numDigits, String finishOnKey, URL callbackUrl) {
//         init(play, numDigits, finishOnKey, callbackUrl);
//     }
// 
//     public GetDigits(Play play) {
//         init(play, 0, null, null);
//     }
// 
//     private void init(Action child, int numDigits, String finishOnKey, URL callbackUrl) {
//         this.tag = "GetDigits";
// 
//         if (numDigits > 0) {
//             this.attributes.put("numDigits", String.valueOf(numDigits));
//         }
// 
//         if (finishOnKey != null) {
//             this.attributes.put("finishOnKey", finishOnKey);
//         }
// 
//         if (callbackUrl != null) {
//             this.attributes.put("callbackUrl", callbackUrl.toString());
//         }
// 
//         this.children.add(child);
//     }
// }
// 
// Path: libs/voice/src/main/java/com/africastalking/voice/action/Say.java
// public class Say extends Action {
// 
//     public enum Voice { MAN, WOMAN }
// 
//     /**
//      * Say
//      * @param text
//      * @param playBeep
//      * @param voice
//      */
//     public Say(String text, boolean playBeep, Voice voice) {
//         this.tag = "Say";
//         this.text = text;
// 
//         if (playBeep) {
//             this.attributes.put("playBeep", "true");
//         }
// 
//         if (voice != null) {
//             this.attributes.put("voice", voice.name().toLowerCase());
//         }
//     }
// 
//     public Say(String text) {
//         this(text, false, null);
//     }
// 
//     public Say(String text, Voice voice) {
//         this(text, false, voice);
//     }
// 
//     public Say(String text, boolean playBeep) {
//         this(text, playBeep, null);
//     }
// 
// }


// Path: libs/core/src/test/java/com/africastalking/test/voice/VoiceTest.java
import com.africastalking.*;
import com.africastalking.test.Fixtures;
import com.africastalking.voice.CallResponse;
import com.africastalking.voice.QueuedCallsResponse;
import com.africastalking.voice.action.GetDigits;
import com.africastalking.voice.action.Record;
import com.africastalking.voice.action.Say;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;

    }

    @Test
    public void testUploadMediaFile() {
        VoiceService service = AfricasTalking.getService(VoiceService.class);
        try {
            final String response = service.uploadMediaFile("+254718769889", "http://defef.klo/wave.mp3");
            Assert.assertNotNull(response);
        } catch (IOException e) {
            Assert.fail(e.getMessage());
        }
    }

    @Test
    public void testXmlBuilder() {
        ActionBuilder builder = new ActionBuilder();

        String say = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Say voice=\"man\">Your balance is 1234 Shillings</Say></Response>";
        Assert.assertEquals(say, builder.say(new Say("Your balance is 1234 Shillings", false, Say.Voice.MAN)).build());

        builder = new ActionBuilder();

        String getDigits  = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<Response>" +
                "<GetDigits finishOnKey=\"#\">" +
                "<Say>Please enter your account number followed by the hash sign</Say>" +
                "</GetDigits>" +
                "<Record/>" +
                "</Response>";
        String getDigitsTest = builder
                .getDigits(new GetDigits(