@Test(expected = IllegalArgumentException.class) public void testGetDirectionWithDuplicateInput() { getDirection(v2, v2); }
public static Direction getDirection(Version from, Version to) { checkArgument(from != null, "You must specify a 'from' version!"); checkArgument(to != null, "You must specify a 'to' version!"); int fromGeneration = getGeneration(from); int toGeneration = getGeneration(to); if (fromGeneration > toGeneration) { return Direction.BACKWARDS; } else if (toGeneration > fromGeneration) { return Direction.FORWARDS; } throw new IllegalArgumentException("These are different versions but in the same generation: " + from + ", " + to); }
VersionTraverser { public static Direction getDirection(Version from, Version to) { checkArgument(from != null, "You must specify a 'from' version!"); checkArgument(to != null, "You must specify a 'to' version!"); int fromGeneration = getGeneration(from); int toGeneration = getGeneration(to); if (fromGeneration > toGeneration) { return Direction.BACKWARDS; } else if (toGeneration > fromGeneration) { return Direction.FORWARDS; } throw new IllegalArgumentException("These are different versions but in the same generation: " + from + ", " + to); } }
VersionTraverser { public static Direction getDirection(Version from, Version to) { checkArgument(from != null, "You must specify a 'from' version!"); checkArgument(to != null, "You must specify a 'to' version!"); int fromGeneration = getGeneration(from); int toGeneration = getGeneration(to); if (fromGeneration > toGeneration) { return Direction.BACKWARDS; } else if (toGeneration > fromGeneration) { return Direction.FORWARDS; } throw new IllegalArgumentException("These are different versions but in the same generation: " + from + ", " + to); }  }
VersionTraverser { public static Direction getDirection(Version from, Version to) { checkArgument(from != null, "You must specify a 'from' version!"); checkArgument(to != null, "You must specify a 'to' version!"); int fromGeneration = getGeneration(from); int toGeneration = getGeneration(to); if (fromGeneration > toGeneration) { return Direction.BACKWARDS; } else if (toGeneration > fromGeneration) { return Direction.FORWARDS; } throw new IllegalArgumentException("These are different versions but in the same generation: " + from + ", " + to); }  static Direction getDirection(Version from, Version to); static Version getFirst(Set<Version> versions); static Optional<List<Version>> findPath(Version from, Version to); static Optional<List<Version>> findChildPath(Version from, Version to); static Optional<List<Version>> findParentPath(Version from, Version to); static List<Stage> verifyPathAndState(State state, Version from, Version to); }
VersionTraverser { public static Direction getDirection(Version from, Version to) { checkArgument(from != null, "You must specify a 'from' version!"); checkArgument(to != null, "You must specify a 'to' version!"); int fromGeneration = getGeneration(from); int toGeneration = getGeneration(to); if (fromGeneration > toGeneration) { return Direction.BACKWARDS; } else if (toGeneration > fromGeneration) { return Direction.FORWARDS; } throw new IllegalArgumentException("These are different versions but in the same generation: " + from + ", " + to); }  static Direction getDirection(Version from, Version to); static Version getFirst(Set<Version> versions); static Optional<List<Version>> findPath(Version from, Version to); static Optional<List<Version>> findChildPath(Version from, Version to); static Optional<List<Version>> findParentPath(Version from, Version to); static List<Stage> verifyPathAndState(State state, Version from, Version to);  }