### Question:
JsObjectApiRefServiceImpl extends AbstractApiRefService implements JsObjectApiRefService { @Override @Transactional public <T extends ApiObject> void save(Integer apiRepoId, RefData<T> refData) { ApiRepoVersion apiRepoVersion = saveApiRepoVersion(apiRepoId, refData); if(refData.getShortRefName().equals("master")) { clearRefSchemas(apiRepoVersion.getId()); clearRefApis(apiRepoVersion.getId()); } saveSchemas(apiRepoVersion, refData.getSchemas(), refData.getCreateUserId()); saveApiJsObjects(apiRepoVersion, refData); }  @Override @Transactional void save(Integer apiRepoId, RefData<T> refData); @Override void clearRefApis(Integer apiRepoVersionId);  }### Answer:
@Test public void save_success() { Integer createUserId = 1; String gitUrl = "https: String version = "1.0.0"; RepoConfigJson repoConfig = new RepoConfigJson(); repoConfig.setName("name1"); repoConfig.setRepo("API"); repoConfig.setDisplayName("display name"); repoConfig.setDescription("description"); repoConfig.setCategory("WebApi"); List<JsObjectData> jsObjects = new ArrayList<>(); JsObjectData jsObject1 = new JsObjectData(); jsObject1.setCode("0001"); jsObject1.setName("jsObject1"); jsObject1.setDescription("js obj desc"); JsFunction func1 = new JsFunction(); func1.setCode("0001"); func1.setName("func1"); func1.setDescription("func desc"); func1.setReturnType("void"); Parameter param1 = new Parameter(); param1.setCode("0001"); param1.setName("param1"); param1.setType("string"); func1.setParameters(Collections.singletonList(param1)); jsObject1.setFunctions(Collections.singletonList(func1)); jsObjects.add(jsObject1); RefData<JsObjectData> refData = new RefData<>(); refData.setGitUrl(gitUrl); refData.setShortRefName(version); refData.setFullRefName("refs/tags/v" + version); refData.setRepoConfig(repoConfig); refData.setApiObjects(jsObjects); refData.setCreateUserId(createUserId); Integer apiRepoId = 1; jsObjectApiRefService.save(apiRepoId, refData); Optional<ApiRepoVersion> expectedVersionOption = apiRepoVersionDao.findByApiRepoIdAndVersion(apiRepoId, version); assertThat(expectedVersionOption).isPresent(); assertThat(expectedVersionOption.get()).hasNoNullFieldsOrProperties(); List<ApiJsObject> expectedJsObjects = apiJsObjectDao.findAll(); assertThat(expectedJsObjects).hasSize(1); assertThat(expectedJsObjects).first().hasNoNullFieldsOrPropertiesExcept("lastUpdateTime", "lastUpdateUserId"); List<ApiJsFunction> expectedJsFunctions = apiJsFunctionDao.findAll(); assertThat(expectedJsFunctions).hasSize(1); assertThat(expectedJsFunctions).first().hasNoNullFieldsOrProperties(); List<ApiJsFunctionArgument> expectedFuncArgs = apiJsFunctionArgumentDao.findAll(); assertThat(expectedFuncArgs).hasSize(1); assertThat(expectedFuncArgs).first().hasNoNullFieldsOrProperties(); }