diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
index 5b4a1f87a5f61fa644a131f956203ce440712308..2fc4fe881a6bba427832e181e1d87dbccec9d254 100644
--- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
@@ -24,7 +24,13 @@ namespace OCA\Federation\Tests\BackgroundJob;
 
 
 use OCA\Federation\BackgroundJob\RequestSharedSecret;
+use OCA\Federation\DbHandler;
+use OCA\Federation\TrustedServers;
 use OCP\AppFramework\Http;
+use OCP\BackgroundJob\IJobList;
+use OCP\Http\Client\IClient;
+use OCP\Http\Client\IResponse;
+use OCP\IURLGenerator;
 use Test\TestCase;
 
 class RequestSharedSecretTest extends TestCase {
diff --git a/apps/federation/tests/Lib/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php
similarity index 99%
rename from apps/federation/tests/Lib/DbHandlerTest.php
rename to apps/federation/tests/DbHandlerTest.php
index 03a740b0277fa5ba138353890c579ad27f9eca73..6e5b8f2f06cc17c5d58b95b94f2d19f38d521ce3 100644
--- a/apps/federation/tests/Lib/DbHandlerTest.php
+++ b/apps/federation/tests/DbHandlerTest.php
@@ -21,7 +21,7 @@
  */
 
 
-namespace OCA\Federation\Tests\Lib;
+namespace OCA\Federation\Tests;
 
 
 use OCA\Federation\DbHandler;
diff --git a/apps/federation/tests/Lib/HooksTest.php b/apps/federation/tests/HooksTest.php
similarity index 98%
rename from apps/federation/tests/Lib/HooksTest.php
rename to apps/federation/tests/HooksTest.php
index 6f917b4bb62cbddad9ca3d5919adad219775147a..014829d9cf61add45871a28b0484e5a834ba0889 100644
--- a/apps/federation/tests/Lib/HooksTest.php
+++ b/apps/federation/tests/HooksTest.php
@@ -20,7 +20,7 @@
  */
 
 
-namespace OCA\Federation\Tests\Lib;
+namespace OCA\Federation\Tests;
 
 
 use OCA\Federation\Hooks;
diff --git a/apps/federation/tests/Lib/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php
similarity index 95%
rename from apps/federation/tests/Lib/SyncFederationAddressbooksTest.php
rename to apps/federation/tests/SyncFederationAddressbooksTest.php
index 2d7945b96905efe427bccd88a41d875ca1c3ffaa..4c266fae3a090e85ab39ebc4cfbdcdef2d80e551 100644
--- a/apps/federation/tests/Lib/SyncFederationAddressbooksTest.php
+++ b/apps/federation/tests/SyncFederationAddressbooksTest.php
@@ -20,7 +20,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>
  *
  */
-namespace OCA\Federation\Tests\Lib;
+namespace OCA\Federation\Tests;
 
 use OCA\Federation\DbHandler;
 use OCA\Federation\SyncFederationAddressBooks;
@@ -52,6 +52,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
 		$syncService->expects($this->once())->method('syncRemoteAddressBook')
 			->willReturn(1);
 
+		/** @var \OCA\DAV\CardDAV\SyncService $syncService */
 		$s = new SyncFederationAddressBooks($dbHandler, $syncService);
 		$s->syncThemAll(function($url, $ex) {
 			$this->callBacks[] = [$url, $ex];
@@ -79,6 +80,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
 		$syncService->expects($this->once())->method('syncRemoteAddressBook')
 			->willThrowException(new \Exception('something did not work out'));
 
+		/** @var \OCA\DAV\CardDAV\SyncService $syncService */
 		$s = new SyncFederationAddressBooks($dbHandler, $syncService);
 		$s->syncThemAll(function($url, $ex) {
 			$this->callBacks[] = [$url, $ex];
diff --git a/apps/federation/tests/Lib/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php
similarity index 96%
rename from apps/federation/tests/Lib/TrustedServersTest.php
rename to apps/federation/tests/TrustedServersTest.php
index 167734b2f6112a3c88a5098662e11e73c945358e..e49db2556be1b2cf0118039e347a691e925d1963 100644
--- a/apps/federation/tests/Lib/TrustedServersTest.php
+++ b/apps/federation/tests/TrustedServersTest.php
@@ -21,7 +21,7 @@
  */
 
 
-namespace OCA\Federation\Tests\Lib;
+namespace OCA\Federation\Tests;
 
 
 use OCA\Federation\DbHandler;
@@ -38,7 +38,7 @@ use Test\TestCase;
 
 class TrustedServersTest extends TestCase {
 
-	/** @var  TrustedServers */
+	/** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers */
 	private $trustedServers;
 
 	/** @var  \PHPUnit_Framework_MockObject_MockObject | DbHandler */
@@ -101,7 +101,7 @@ class TrustedServersTest extends TestCase {
 	 * @param bool $success
 	 */
 	public function testAddServer($success) {
-		/** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServer */
+		/** @var \PHPUnit_Framework_MockObject_MockObject|TrustedServers $trustedServers */
 		$trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
 			->setConstructorArgs(
 				[
@@ -172,7 +172,7 @@ class TrustedServersTest extends TestCase {
 			->with('federation', 'autoAddServers', '1')->willReturn($status);
 
 		$this->assertSame($expected,
-			$this->trustedServers->getAutoAddServers($status)
+			$this->trustedServers->getAutoAddServers()
 		);
 	}
 
@@ -208,6 +208,7 @@ class TrustedServersTest extends TestCase {
 				function($eventId, $event) {
 					$this->assertSame($eventId, 'OCP\Federation\TrustedServerEvent::remove');
 					$this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event);
+					/** @var \Symfony\Component\EventDispatcher\GenericEvent $event */
 					$this->assertSame('url_hash', $event->getSubject());
 				}
 			);
@@ -215,9 +216,10 @@ class TrustedServersTest extends TestCase {
 	}
 
 	public function testGetServers() {
-		$this->dbHandler->expects($this->once())->method('getAllServer')->willReturn(true);
+		$this->dbHandler->expects($this->once())->method('getAllServer')->willReturn(['servers']);
 
-		$this->assertTrue(
+		$this->assertEquals(
+			['servers'],
 			$this->trustedServers->getServers()
 		);
 	}
@@ -257,7 +259,7 @@ class TrustedServersTest extends TestCase {
 
 		$server = 'server1';
 
-		/** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServer */
+		/** @var \PHPUnit_Framework_MockObject_MockObject | TrustedServers $trustedServers */
 		$trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
 			->setConstructorArgs(
 				[