util classes should be final with a private constructor

This commit is contained in:
Sebastian Sdorra
2013-02-11 15:28:14 +01:00
parent 961c6f7f02
commit 114834d257
22 changed files with 232 additions and 51 deletions

View File

@@ -30,6 +30,7 @@
*/
package sonia.scm.repository;
/**
@@ -37,7 +38,7 @@ package sonia.scm.repository;
* @author Sebastian Sdorra
* @since 1.18
*/
public class PersonTestData
public final class PersonTestData
{
/** Field description */
@@ -67,4 +68,12 @@ public class PersonTestData
/** Field description */
public static final Person ZAPHOD =
Person.toPerson("Zaphod Beeblebrox <zaphod.beeblebrox@hitchhiker.com>");
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
*
*/
private PersonTestData() {}
}

View File

@@ -37,9 +37,17 @@ package sonia.scm.repository;
*
* @author Sebastian Sdorra
*/
public class RepositoryTestData
public final class RepositoryTestData
{
/**
* Constructs ...
*
*/
private RepositoryTestData() {}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
@@ -80,7 +88,7 @@ public class RepositoryTestData
public static Repository createHappyVerticalPeopleTransporter()
{
return createHappyVerticalPeopleTransporter(
DummyRepositoryHandler.TYPE_NAME);
DummyRepositoryHandler.TYPE_NAME);
}
/**
@@ -97,12 +105,12 @@ public class RepositoryTestData
happyVerticalPeopleTransporter.setType(type);
happyVerticalPeopleTransporter.setContact(
"zaphod.beeblebrox@hitchhiker.com");
"zaphod.beeblebrox@hitchhiker.com");
happyVerticalPeopleTransporter.setName("happyVerticalPeopleTransporter");
happyVerticalPeopleTransporter.setDescription(
"Happy Vertical People Transporter");
"Happy Vertical People Transporter");
happyVerticalPeopleTransporter.setUrl(
"http://hitchhiker.com/dummy/HeartOfGold");
"http://hitchhiker.com/dummy/HeartOfGold");
return happyVerticalPeopleTransporter;
}
@@ -134,7 +142,7 @@ public class RepositoryTestData
heartOfGold.setContact("zaphod.beeblebrox@hitchhiker.com");
heartOfGold.setName("HeartOfGold");
heartOfGold.setDescription(
"Heart of Gold is the first prototype ship to successfully utilise the revolutionary Infinite Improbability Drive");
"Heart of Gold is the first prototype ship to successfully utilise the revolutionary Infinite Improbability Drive");
heartOfGold.setUrl("http://hitchhiker.com/dummy/HeartOfGold");
return heartOfGold;
@@ -149,7 +157,7 @@ public class RepositoryTestData
public static Repository createRestaurantAtTheEndOfTheUniverse()
{
return createRestaurantAtTheEndOfTheUniverse(
DummyRepositoryHandler.TYPE_NAME);
DummyRepositoryHandler.TYPE_NAME);
}
/**

View File

@@ -41,9 +41,17 @@ import java.io.File;
*
* @author Sebastian Sdorra
*/
public class RepositoryClientFactory
public final class RepositoryClientFactory
{
/**
* Constructs ...
*
*/
private RepositoryClientFactory() {}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
@@ -57,8 +65,8 @@ public class RepositoryClientFactory
* @throws RepositoryClientException
*/
public static RepositoryClient createClient(String type,
File localRepository, String remoteRepository)
throws RepositoryClientException
File localRepository, String remoteRepository)
throws RepositoryClientException
{
return createClient(type, localRepository, remoteRepository, null, null);
}
@@ -78,9 +86,9 @@ public class RepositoryClientFactory
* @throws RepositoryClientException
*/
public static RepositoryClient createClient(String type,
File localRepository, String remoteRepository, String username,
String password)
throws RepositoryClientException
File localRepository, String remoteRepository, String username,
String password)
throws RepositoryClientException
{
RepositoryClient client = null;
@@ -89,17 +97,17 @@ public class RepositoryClientFactory
if ("git".equals(type))
{
client = new GitRepositoryClient(localRepository, remoteRepository,
username, password);
username, password);
}
else if ("svn".equals(type))
{
client = new SvnRepositoryClient(localRepository, remoteRepository,
username, password);
username, password);
}
else if ("hg".equals(type))
{
client = new HgRepositoryClient(localRepository, remoteRepository,
username, password);
username, password);
}
}
catch (Exception ex)

View File

@@ -37,9 +37,17 @@ package sonia.scm.user;
*
* @author Sebastian Sdorra
*/
public class UserTestData
public final class UserTestData
{
/**
* Constructs ...
*
*/
private UserTestData() {}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
@@ -104,7 +112,7 @@ public class UserTestData
public static User createTrillian()
{
return new User("trillian", "Tricia McMillan",
"tricia.mcmillan@hitchhiker.com");
"tricia.mcmillan@hitchhiker.com");
}
/**
@@ -116,6 +124,6 @@ public class UserTestData
public static User createZaphod()
{
return new User("zaphod", "Zaphod Beeblebrox",
"zaphod.beeblebrox@hitchhiker.com");
"zaphod.beeblebrox@hitchhiker.com");
}
}