Avoid casting RepositoryManager to LocalDiskRepositoryManager Inject directly the expected class of LocalDiskRepositoryManager without assuming that the one provided by the AbstractDaemonTest. The Change I8d288fa3 will replace the repository manager with a wrapping repository tracking system, therefore the casting may not be satisfied anymore and it may fail at runtime. Release-Notes: skip Change-Id: I8e410ae6a489b1127ef09d4c203ab9aa1d711d8d
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDaemon.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDaemon.java index ba4a958..f7af631 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDaemon.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDaemon.java
@@ -70,6 +70,7 @@ @Inject protected SitePaths sitePaths; @Inject private ProjectOperations projectOperations; + @Inject private LocalDiskRepositoryManager localDiskRepositoryManager; protected Path gitPath; protected FileBasedConfig config; @@ -79,7 +80,7 @@ } protected String getProjectUri(Project.NameKey project) throws Exception { - return ((LocalDiskRepositoryManager) repoManager) + return localDiskRepositoryManager .getBasePath(project) .resolve(project.get() + ".git") .toString();