If you want to test a contract that depends on other contract, but you don't own the latter contract (or you do but you want to test the first contract in isolation), you need to either stub or mock that dependency.
If you are not sure about the difference between a stub and a mock, check this StackOverflow question
If the contract you are testing receives its dependency in some way, you can write a stub contract and use that in your tests. It would be something like this:
contract ContractToTest {