package com.github.avarabyeu.restendpoint.http.proxy;

import com.github.avarabyeu.restendpoint.async.Will;
import com.google.common.reflect.Invokable;
import com.smarttested.qa.smartassert.SmartAssert;
import org.junit.Test;

import static com.github.avarabyeu.restendpoint.http.proxy.RestMethodInfo.isAsynchronous;
import static org.hamcrest.CoreMatchers.is;

/**
 * @author Andrei Varabyeu
 */
public class RestMethodInfoTest {


    @Test
    public void testSynchronousParser() throws NoSuchMethodException {
        Invokable<?, Object> testSyncronousMethod = Invokable.from(this.getClass().getDeclaredMethod("testSyncronousMethod"));
        Invokable<?, Object> testAsyncronousMethod = Invokable.from(this.getClass().getDeclaredMethod("testAsyncronousMethod"));
        Invokable<?, Object> testVoidMethod = Invokable.from(this.getClass().getDeclaredMethod("testVoidMethod"));
        System.out.println(isAsynchronous(testSyncronousMethod));

        SmartAssert.assertSoft(isAsynchronous(testSyncronousMethod), is(false), "Incorrect synchronous method detection");
        SmartAssert.assertSoft(isAsynchronous(testAsyncronousMethod), is(true), "Incorrect asynchronous method detection");
        SmartAssert.assertSoft(isAsynchronous(testVoidMethod), is(false), "Incorrect void method detection");
    }

    String testSyncronousMethod() {
        return null;
    }

    Will<String> testAsyncronousMethod() {
        return null;
    }

    void testVoidMethod() {

    }
}

@@ -1305,24 +1305,67 @@
 n%22);%0A    %7D%0A%0A
+    @SuppressWarnings(%22UnusedDeclaration%22)%0A
     String t
@@ -1412,24 +1412,67 @@
 ull;%0A    %7D%0A%0A
+    @SuppressWarnings(%22UnusedDeclaration%22)%0A
     Will%3CStr
@@ -1526,24 +1526,67 @@
 ull;%0A    %7D%0A%0A
+    @SuppressWarnings(%22UnusedDeclaration%22)%0A
     void tes

update unit test