testFromMachinePerspective(localMachineName, currentLocalVersion, allBranches, expectedTestResult);
}
@Test
public void testStitchBranches() throws Exception {
DatabaseBranches allBranches = new DatabaseBranches();
allBranches.put("A", TestDatabaseUtil.createBranch(new String[] {
"A/(A1)/T=1376074225169",
"A/(A2)/T=1376074225230",
"A/(A3)/T=1376074225256",
}));
allBranches.put("B", TestDatabaseUtil.createBranch(new String[] {
"B/(A3,B1)/T=1376074225356"
}));
allBranches.put("C", TestDatabaseUtil.createBranch(new String[] {
"C/(C1)/T=1376074225383",
"C/(C2)/T=1376074225399",
"C/(C3)/T=1376074225416",
}));
DatabaseReconciliator databaseVersionUpdateDetector = new DatabaseReconciliator();
DatabaseBranches actualStitchedRemoteBranches = databaseVersionUpdateDetector.stitchBranches(allBranches, "D", new DatabaseBranch());
DatabaseBranches expectedStitchedBranches = new DatabaseBranches();
expectedStitchedBranches.put("A", TestDatabaseUtil.createBranch(new String[] {
"A/(A1)/T=1376074225169",
"A/(A2)/T=1376074225230",
"A/(A3)/T=1376074225256",
}));
expectedStitchedBranches.put("B", TestDatabaseUtil.createBranch(new String[] {
"A/(A1)/T=1376074225169",
"A/(A2)/T=1376074225230",
"A/(A3)/T=1376074225256",
"B/(A3,B1)/T=1376074225356"
}));
expectedStitchedBranches.put("C", TestDatabaseUtil.createBranch(new String[] {
"C/(C1)/T=1376074225383",
"C/(C2)/T=1376074225399",
"C/(C3)/T=1376074225416",
}));
assertEquals("Stitched branches not equal.", expectedStitchedBranches.toString(), actualStitchedRemoteBranches.toString());
}