package cc.smtweb.system.bpm.test;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.controller.MethodAccessManager;
import cc.smtweb.system.bpm.spring.BpmApplication;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.Map;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = {BpmApplication.class})
public class BpmTest {
  @Autowired
  private MethodAccessManager methodAccessManager;

  private R invoke(String url, Map<String, Object> body) throws Exception {
//    Map<String, Object> params = new HashMap<>();
//    return methodAccessManager.invokeDirect(url, params, JsonUtil.encodeString(body));
    return null;
  }

  @Test
  public void load() throws Exception {
    R r = invoke("bpm/BpmTaskCard/load", SwMap.of("flowId", 476347272070696960L));

    System.out.println(r);

    Assertions.assertEquals(0, r.readInt("code"));
    Assertions.assertNotEquals(null, r.get("data"));
  }

}
