BranchFilterByRemote { public boolean isLinkedTo(Branch branch) { return branch.getName().startsWith(refsForRemoteRepository); } BranchFilterByRemote(String remoteName); boolean isLinkedTo(Branch branch); String getBranchNameWithoutRefs(Branch branch);  }
@Test public void shouldDetermineLinkBranchToRemote() throws Exception { when(branch.getName()).thenReturn("refs/remotes/" + REMOTE_NAME + "/master"); assertTrue(branchFilterByRemote.isLinkedTo(branch)); }
@Test public void shouldNotDetermineLinkBranchToRemote() throws Exception { when(branch.getName()).thenReturn("refs/remotes/" + ANOTHER_REMOTE_NAME + "/master"); assertFalse(branchFilterByRemote.isLinkedTo(branch)); }