/*
 * Copyright 2018 iserge.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.cesiumjs.cs.core;

import junit.framework.TestCase;
import org.cesiumjs.cs.BaseTestCase;
import org.cesiumjs.cs.Cesium;
import org.cesiumjs.cs.promise.Fulfill;
import org.cesiumjs.cs.promise.Reject;

/**
 * @author Serge Silaev aka iSergio <s.serge.b@gmail.com>
 */
public class IonResourceTest extends BaseTestCase {

    public void testFromAssetId() {
        super.beginTest(new Test() {
            @Override
            public void execute() {
                IonResource.fromAssetId(10890).then(new Fulfill<IonResource>() {
                    @Override
                    public void onFulfilled(IonResource resource) {
                        assertNotNull(resource);
                    }
                }, new Reject<Void>() {
                    @Override
                    public void onRejected(Void value) {
                        Cesium.log("Request rejected");
                        assertTrue(true);
                    }
                });
            }
        });

        super.beginTest(new Test() {
            @Override
            public void execute() {
                IonResource.fromAssetId(3883).then(new Fulfill<IonResource>() {
                    @Override
                    public void onFulfilled(IonResource value) {
                        assertNotNull(value);
                    }
                }, new Reject<Void>() {
                    @Override
                    public void onRejected(Void value) {
                        Cesium.log("Request rejected");
                        assertTrue(true);
                    }
                });
            }
        });
    }
}
@@ -627,100 +627,36 @@
 ort 
-junit.framework.TestCase;%0Aimport org.cesiumjs.cs.BaseTestCase;%0Aimport org.cesiumjs.cs.Cesium
+org.cesiumjs.cs.BaseTestCase
 ;%0Aim
@@ -851,17 +851,16 @@
 tCase %7B%0A
-%0A
     publ
@@ -882,21 +882,56 @@
 mAssetId
+1
 () %7B%0A
+        delayTestFinish(10_000);%0A%0A
         
@@ -1061,13 +1061,12 @@
 tId(
-10890
+3827
 ).th
@@ -1240,24 +1240,62 @@
 (resource);%0A
+                        finishTest();%0A
             
@@ -1459,37 +1459,19 @@
     
-Cesium.log(%22Request rejected%22
+finishTest(
 );%0A 
@@ -1489,37 +1489,17 @@
         
-    assertTrue(true);
+%7D
 %0A       
@@ -1503,38 +1503,40 @@
             
+%7D);%0A
     
-%7D%0A
         
         %7D);%0A
@@ -1515,32 +1515,34 @@
 %7D);%0A            
+%7D%0A
         %7D);%0A    
@@ -1541,35 +1541,86 @@
 %7D);%0A    
+%7D%0A%0A
     
-    %7D%0A        %7D
+public void testFromAssetId2() %7B%0A        delayTestFinish(10_000
 );%0A%0A    
@@ -1755,11 +1755,11 @@
 Id(3
-883
+956
 ).th
@@ -1876,20 +1876,23 @@
 esource 
-valu
+resourc
 e) %7B%0A   
@@ -1926,21 +1926,62 @@
 NotNull(
-value
+resource);%0A                        finishTest(
 );%0A     
@@ -2152,79 +2152,19 @@
     
-Cesium.log(%22Request rejected%22);%0A                        assertTrue(true
+finishTest(
 );%0A 

Correct execute async methods