/*
Copyright (c) 2007-2010, Yusuke Yamamoto
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the Yusuke Yamamoto nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package twitter4j.util;

import java.io.InputStream;

import twitter4j.TwitterTestBase;
import twitter4j.conf.ConfigurationContext;
import twitter4j.http.AccessToken;
import twitter4j.http.OAuthAuthorization;

/**
 * @author Takao Nakaguchi - takao.nakaguchi at gmail.com
 * @since Twitter4J 2.1.4
 */
public class ImageUploadTest extends TwitterTestBase {
    public ImageUploadTest(String name) {
        super(name);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        screenName = p.getProperty("id1");
        oauthAuthorization = new OAuthAuthorization(
                ConfigurationContext.getInstance()
                , p.getProperty("desktopConsumerKey")
                , p.getProperty("desktopConsumerSecret")
                , new AccessToken(
                        p.getProperty("id1.oauth_token")
                        , p.getProperty("id1.oauth_token_secret")
                )
        );
        twitpicApiKey = p.getProperty("twitpic.apiKey");
        tweetPhotoApiKey = p.getProperty("tweetPhoto.apiKey");
    }

    public void testTwitPicOAuthUploader() throws Exception {
        InputStream is = getClass().getResourceAsStream("/" + fileName);
        try {
            String url = ImageUpload.getTwitpicUploader(
                    twitpicApiKey, oauthAuthorization
            ).upload(fileName, is, message);
            assertTrue(url.length() > 0);
        } finally {
            is.close();
        }
    }

    public void testYFrogOAuthUploader() throws Exception {
        InputStream is = getClass().getResourceAsStream("/" + fileName);
        try {
            String url = ImageUpload.getYFrogUploader(
                    screenName, oauthAuthorization
            ).upload(fileName, is, message);
            assertTrue(url.length() > 0);
        } finally {
            is.close();
        }
    }

    public void testTweetPhotoOAuthUploader() throws Exception {
        InputStream is = getClass().getResourceAsStream("/" + fileName);
        try {
            String url = ImageUpload.getTweetPhotoUploader(
                    tweetPhotoApiKey, oauthAuthorization
            ).upload(fileName, is, message);
            assertTrue(url.length() > 0);
        } finally {
            is.close();
        }
    }

    private OAuthAuthorization oauthAuthorization;
    private String screenName;
    private String twitpicApiKey;
    private String tweetPhotoApiKey;
    private String fileName = "t4j.jpeg";
    private String message = "Twitter4J image upload test";
}

@@ -3787,24 +3787,806 @@
    %7D%0A    %7D%0A%0A
+    public void testImgLyOAuthUploader() throws Exception %7B%0A        InputStream is = getClass().getResourceAsStream(%22/%22 + fileName);%0A        try %7B%0A            String url = ImageUpload.getImgLyUploader(%0A                    oauthAuthorization%0A            ).upload(fileName, is, message);%0A            assertTrue(url.length() %3E 0);%0A        %7D finally %7B%0A            is.close();%0A        %7D%0A    %7D%0A%0A    public void testTwitgooOAuthUploader() throws Exception %7B%0A        InputStream is = getClass().getResourceAsStream(%22/%22 + fileName);%0A        try %7B%0A            String url = ImageUpload.getTwitgooUploader(%0A                    oauthAuthorization%0A            ).upload(fileName, is, message);%0A            assertTrue(url.length() %3E 0);%0A        %7D finally %7B%0A            is.close();%0A        %7D%0A    %7D%0A%0A
     private 

add test case for img.ly and twitgoo.