Added FIXME comments to wrong used assert statements
This commit is contained in:
parent
00c4101063
commit
fdd5783d8e
4 changed files with 11 additions and 5 deletions
|
@ -123,6 +123,7 @@ public class Hub {
|
|||
* request.
|
||||
*/
|
||||
public void sendNotification(final String requestHost, final String topic) {
|
||||
// FIXME assert should not be used for validation because it can be disabled
|
||||
assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic;
|
||||
LOG.debug("Sending notification for {}", topic);
|
||||
try {
|
||||
|
@ -179,6 +180,7 @@ public class Hub {
|
|||
LOG.debug("{} wants to subscribe to {}", callback, topic);
|
||||
try {
|
||||
try {
|
||||
// FIXME assert should not be used for validation because it can be disabled
|
||||
assert callback != null : "Callback URL is required.";
|
||||
assert topic != null : "Topic URL is required.";
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ public class JPADAO implements HubDAO {
|
|||
|
||||
@Override
|
||||
public Subscriber addSubscriber(final Subscriber subscriber) {
|
||||
// FIXME assert should not be used for validation because it can be disabled
|
||||
assert subscriber != null : "Attempt to store a null subscriber";
|
||||
final EntityManager em = factory.createEntityManager();
|
||||
final EntityTransaction tx = em.getTransaction();
|
||||
|
|
|
@ -39,6 +39,7 @@ public class InMemoryHubDAO implements HubDAO {
|
|||
|
||||
@Override
|
||||
public Subscriber addSubscriber(final Subscriber subscriber) {
|
||||
// FIXME assert should not be used for validation because it can be disabled
|
||||
assert subscriber != null : "Attempt to store a null subscriber";
|
||||
|
||||
List<Subscriber> subList = subscribers.get(subscriber.getTopic());
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.rometools.certiorem.hub.data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -46,11 +47,12 @@ public abstract class AbstractDAOTest {
|
|||
|
||||
final Subscriber result = instance.addSubscriber(subscriber);
|
||||
|
||||
assert result.equals(subscriber) : "Subscriber not equal.";
|
||||
Assert.assertTrue("Subscriber not equal", result.equals(subscriber));
|
||||
|
||||
final List<? extends Subscriber> subscribers = instance.subscribersForTopic(subscriber.getTopic());
|
||||
|
||||
assert subscribers.contains(result) : "Subscriber not in result.";
|
||||
Assert.assertTrue("Subscriber not in result", subscribers.contains(result));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,14 +67,14 @@ public abstract class AbstractDAOTest {
|
|||
|
||||
final Subscriber result = instance.addSubscriber(subscriber);
|
||||
|
||||
assert subscriber.equals(result) : "Subscriber not equal.";
|
||||
Assert.assertEquals("Subscriber not equal", subscriber, result);
|
||||
// quick test for store.
|
||||
List<? extends Subscriber> subscribers = instance.subscribersForTopic(subscriber.getTopic());
|
||||
assert subscribers.contains(result) : "Subscriber not in result.";
|
||||
Assert.assertTrue("Subscriber not in result", subscribers.contains(result));
|
||||
// sleep past expiration
|
||||
Thread.sleep(1100);
|
||||
subscribers = instance.subscribersForTopic(subscriber.getTopic());
|
||||
assert !subscribers.contains(result) : "Subscriber should have expired";
|
||||
Assert.assertFalse("Subscriber should have expired", subscribers.contains(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue