Im using the official Cloud Foundry Java Client (https://github.com/cloudfoundry/cf-java-client) in a Spring-Boot Project.
How do i mock cloud foundry for Tests ( not Integrationtests ) ?
Im using the official Cloud Foundry Java Client (https://github.com/cloudfoundry/cf-java-client) in a Spring-Boot Project.
How do i mock cloud foundry for Tests ( not Integrationtests ) ?
You don't really mock the Cloud Foundry Java Client for tests. Since you mentioned "not integration tests", so I assume this are unit tests. Your service under test should implement interfaces and the implementation could be delegated to the the CF java client. You can mock the service methods in your unit tests.
...
//you mock this method using mocking frameworks such as mockito
public List<Organization> getOrganizations(){
//pseudo code. code implementation using the CF client.
//the cf client is not the service under test.
return cfclient.organizations().list...
}
...
In the case of integration tests, you can mock an external API call using WireMock. You can mock the responses so the client calls(or your system under test) will handle/process the external API response accordingly.