Package com.heroku.api.play

Source Code of com.heroku.api.play.PlayConnectionTest

package com.heroku.api.play;

import com.google.inject.Inject;
import com.heroku.api.IntegrationTestConfig;
import com.heroku.api.Key;
import com.heroku.api.PlayModule;
import com.heroku.api.connection.PlayWSConnection;
import com.heroku.api.request.key.KeyList;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import play.api.libs.concurrent.Promise;

import java.util.List;
import java.util.concurrent.TimeUnit;

import static org.testng.Assert.assertNotNull;

@Guice(modules = PlayModule.class)
public class PlayConnectionTest {

    @Inject
    PlayWSConnection connection;

    String apiKey = IntegrationTestConfig.CONFIG.getDefaultUser().getApiKey();


    @Test
    @SuppressWarnings("unchecked")
    public void asyncTests() {
        Promise<List<Key>> jsonArrayResponseFuture = connection.executeAsync(new KeyList(), apiKey);
        List<Key> keys = jsonArrayResponseFuture.await(10L, TimeUnit.SECONDS).get();
        assertNotNull(keys);
    }

}
TOP

Related Classes of com.heroku.api.play.PlayConnectionTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.