Created
August 7, 2023 04:21
-
-
Save A-pZ/865401d5a9cae37bfdba665e146fe90d to your computer and use it in GitHub Desktop.
登録した取引先を検索する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Company find(String objectId, AuthenticationResult authenticationResult) { | |
Company result = salesforceWebClient.get() | |
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 作成した取引先のオブジェクトid | |
.header("Authorization", authenticationResult.bearerToken()) | |
.retrieve() | |
.bodyToMono(Company.class) | |
.block(); | |
log.info("result :{}", result); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.apz.salesforcesample.repository | |
import org.springframework.beans.factory.annotation.Autowired | |
import org.springframework.boot.test.context.SpringBootTest | |
import spock.lang.Specification | |
@SpringBootTest | |
class SalesforceSearchTest extends Specification { | |
@Autowired | |
SalesforceAuthentication authentication | |
@Autowired | |
CompanyRepository repository | |
def "取引先検索"() { | |
when: | |
def authenticationResult = authentication.authentication(); | |
def result = repository.find("0010l00001dKTpjAAG", authenticationResult) | |
then: | |
noExceptionThrown() | |
result | |
result.getName() == 'テストコードから登録した会社' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFO 14256 --- [ Test worker] c.g.a.s.repository.CompanyRepository : | |
result :Company( | |
name=テストコードから登録した会社, | |
id=0010l00001dKUmEAAW, | |
recordTypeId=0120o000001TahMAAS | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment