Merge pull request #548 from muditporwal/master
Checkstyle improvements #539 : Added JavaDocType Rule
This commit is contained in:
commit
3f272bf291
@ -28,6 +28,9 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test for abstract factory
|
||||
*/
|
||||
public class AbstractFactoryTest {
|
||||
|
||||
private App app = new App();
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.aggregator.microservices;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* Spring Boot EntryPoint Class
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class App {
|
||||
|
||||
|
@ -22,15 +22,18 @@
|
||||
*/
|
||||
package com.iluwatar.aggregator.microservices;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Test Aggregation of domain objects
|
||||
*/
|
||||
public class AggregatorTest {
|
||||
|
||||
@InjectMocks
|
||||
|
@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Controller providing endpoints to retrieve information about products
|
||||
*/
|
||||
@RestController
|
||||
public class InformationController {
|
||||
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.information.microservice;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test for Information Rest Controller
|
||||
*/
|
||||
public class InformationControllerTest {
|
||||
|
||||
@Test
|
||||
|
@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Controller providing endpoints to retrieve product inventories
|
||||
*/
|
||||
@RestController
|
||||
public class InventoryController {
|
||||
|
||||
|
@ -25,8 +25,10 @@ package com.iluwatar.inventory.microservice;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Inventory Rest Controller
|
||||
*/
|
||||
public class InventoryControllerTest {
|
||||
|
||||
@Test
|
||||
public void testGetProductInventories() throws Exception {
|
||||
InventoryController inventoryController = new InventoryController();
|
||||
|
@ -22,15 +22,18 @@
|
||||
*/
|
||||
package com.iluwatar.api.gateway;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Test API Gateway Pattern
|
||||
*/
|
||||
public class ApiGatewayTest {
|
||||
|
||||
@InjectMocks
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.image.microservice;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test for Image Rest Controller
|
||||
*/
|
||||
public class ImageControllerTest {
|
||||
@Test
|
||||
public void testGetImagePath() {
|
||||
|
@ -25,6 +25,10 @@ package com.iluwatar.price.microservice;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Test for Price Rest Controller
|
||||
*/
|
||||
public class PriceControllerTest {
|
||||
@Test
|
||||
public void testgetPrice() {
|
||||
|
@ -25,8 +25,8 @@ package com.iluwatar.async.method.invocation;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
*
|
||||
* AsyncResult interface
|
||||
* @param <T> parameter returned when getValue is invoked
|
||||
*/
|
||||
public interface AsyncResult<T> {
|
||||
|
||||
|
@ -77,7 +77,6 @@
|
||||
<property name="max" value="120"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap"/>
|
||||
<module name="EmptyBlock">
|
||||
@ -185,6 +184,10 @@
|
||||
<property name="allowedAnnotations" value="Override, Test, Before, After, Parameters, Given, When, BeforeClass, AfterClass, Parameterized"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
</module>
|
||||
<module name="JavadocType">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="allowUnknownTags" value="true"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.dao;
|
||||
|
||||
/**
|
||||
* Customer Schema SQL Class
|
||||
*/
|
||||
public final class CustomerSchemaSql {
|
||||
|
||||
private CustomerSchemaSql() {}
|
||||
|
@ -29,6 +29,9 @@ import static org.junit.Assert.assertNotEquals;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link Customer}.
|
||||
*/
|
||||
public class CustomerTest {
|
||||
|
||||
private Customer customer;
|
||||
|
@ -21,6 +21,9 @@ package com.iluwatar.datamapper;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Class defining Student
|
||||
*/
|
||||
public final class Student implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -20,6 +20,9 @@ package com.iluwatar.datamapper;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Interface lists out the possible behaviour for all possible student mappers
|
||||
*/
|
||||
public interface StudentDataMapper {
|
||||
|
||||
Optional<Student> find(int studentId);
|
||||
|
@ -22,6 +22,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Implementation of Actions on Students Data
|
||||
*/
|
||||
public final class StudentDataMapperImpl implements StudentDataMapper {
|
||||
|
||||
/* Note: Normally this would be in the form of an actual database */
|
||||
|
@ -18,10 +18,14 @@
|
||||
*/
|
||||
package com.iluwatar.datamapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link Student}.
|
||||
*/
|
||||
public final class StudentTest {
|
||||
|
||||
@Test
|
||||
|
@ -22,6 +22,12 @@
|
||||
*/
|
||||
package com.iluwatar.delegation.simple;
|
||||
|
||||
/**
|
||||
* Delegator Class to delegate the implementation of the Printer.
|
||||
* This ensures two things:
|
||||
* - when the actual implementation of the Printer class changes the delegation will still be operational
|
||||
* - the actual benefit is observed when there are more than one implementors and they share a delegation control
|
||||
*/
|
||||
public class PrinterController implements Printer {
|
||||
|
||||
private final Printer printer;
|
||||
|
@ -23,7 +23,9 @@
|
||||
package com.iluwatar.delegation.simple;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Application Test Entry
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
@ -22,22 +22,24 @@
|
||||
*/
|
||||
package com.iluwatar.delegation.simple;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import com.iluwatar.delegation.simple.printers.CanonPrinter;
|
||||
import com.iluwatar.delegation.simple.printers.EpsonPrinter;
|
||||
import com.iluwatar.delegation.simple.printers.HpPrinter;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Test for Delegation Pattern
|
||||
*/
|
||||
public class DelegateTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@ -78,6 +80,9 @@ public class DelegateTest {
|
||||
assertEquals("Epson Printer : Test Message Printed", appender.getLastMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging Appender
|
||||
*/
|
||||
private class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
@ -22,13 +22,14 @@
|
||||
*/
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Date: 12/10/15 - 8:37 PM
|
||||
*
|
||||
* Test for Collision
|
||||
* @param <O> Type of GameObject
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class CollisionTest<O extends GameObject> {
|
||||
|
@ -22,22 +22,22 @@
|
||||
*/
|
||||
package com.iluwatar.event.aggregator;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/12/15 - 10:58 PM
|
||||
*
|
||||
* Tests for Event Emitter
|
||||
* @param <E> Type of Event Emitter
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class EventEmitterTest<E extends EventEmitter> {
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Custom Exception Class for Non Existent Event
|
||||
*/
|
||||
public class EventDoesNotExistException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -3398463738273811509L;
|
||||
|
@ -16,6 +16,10 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Events that fulfill the start stop and list out current status behaviour
|
||||
* follow this interface
|
||||
*/
|
||||
public interface IEvent {
|
||||
|
||||
void start();
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Type of Exception raised when the Operation being invoked is Invalid
|
||||
*/
|
||||
public class InvalidOperationException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -6191545255213410803L;
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Type of Exception raised when the Operation being invoked is Long Running
|
||||
*/
|
||||
public class LongRunningEventException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -483423544320148809L;
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Type of Exception raised when the max number of allowed events is exceeded
|
||||
*/
|
||||
public class MaxNumOfEventsAllowedException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -8430876973516292695L;
|
||||
|
@ -16,6 +16,9 @@
|
||||
*/
|
||||
package com.iluwatar.event.asynchronous;
|
||||
|
||||
/**
|
||||
* Interface with listener behaviour related to Thread Completion.
|
||||
*/
|
||||
public interface ThreadCompleteListener {
|
||||
void completedEventHandler(final int eventId);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ package com.iluwatar.eda.framework;
|
||||
/**
|
||||
* This interface can be implemented to handle different types of messages.
|
||||
* Every handler is responsible for a single of type message
|
||||
* @param <E> Handler can handle events of type E
|
||||
*/
|
||||
public interface Handler<E extends Event> {
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.factorykit;
|
||||
|
||||
/**
|
||||
* Class representing Axe
|
||||
*/
|
||||
public class Axe implements Weapon {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.factorykit;
|
||||
|
||||
/**
|
||||
* Class representing Bows
|
||||
*/
|
||||
public class Bow implements Weapon {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -21,7 +21,9 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package com.iluwatar.factorykit;
|
||||
|
||||
/**
|
||||
* Class representing Spear
|
||||
*/
|
||||
public class Spear implements Weapon {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -21,7 +21,9 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package com.iluwatar.factorykit;
|
||||
|
||||
/**
|
||||
* Class representing Swords
|
||||
*/
|
||||
public class Sword implements Weapon {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.factorykit.app;
|
||||
import com.iluwatar.factorykit.App;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Application Test Entrypoint
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2014-2016 Ilkka Seppälä
|
||||
*
|
||||
@ -22,12 +22,19 @@
|
||||
*/
|
||||
package com.iluwatar.factorykit.factorykit;
|
||||
|
||||
import com.iluwatar.factorykit.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.iluwatar.factorykit.Axe;
|
||||
import com.iluwatar.factorykit.Spear;
|
||||
import com.iluwatar.factorykit.Sword;
|
||||
import com.iluwatar.factorykit.Weapon;
|
||||
import com.iluwatar.factorykit.WeaponFactory;
|
||||
import com.iluwatar.factorykit.WeaponType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
/**
|
||||
* Test Factory Kit Pattern
|
||||
*/
|
||||
public class FactoryKitTest {
|
||||
|
||||
private WeaponFactory factory;
|
||||
|
@ -23,16 +23,18 @@
|
||||
|
||||
package com.iluwatar.featuretoggle.pattern.propertiesversion;
|
||||
|
||||
import com.iluwatar.featuretoggle.pattern.Service;
|
||||
import com.iluwatar.featuretoggle.user.User;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.iluwatar.featuretoggle.pattern.Service;
|
||||
import com.iluwatar.featuretoggle.user.User;
|
||||
import java.util.Properties;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Properties Toggle
|
||||
*/
|
||||
public class PropertiesFeatureToggleVersionTest {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -22,15 +22,18 @@
|
||||
*/
|
||||
package com.iluwatar.featuretoggle.pattern.tieredversion;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.iluwatar.featuretoggle.pattern.Service;
|
||||
import com.iluwatar.featuretoggle.user.User;
|
||||
import com.iluwatar.featuretoggle.user.UserGroup;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Tiered Feature Toggle
|
||||
*/
|
||||
public class TieredFeatureToggleVersionTest {
|
||||
|
||||
final User paidUser = new User("Jamie Coder");
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
package com.iluwatar.featuretoggle.user;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test User Group specific feature
|
||||
*/
|
||||
public class UserGroupTest {
|
||||
|
||||
@Test
|
||||
|
@ -27,6 +27,7 @@ import java.util.Iterator;
|
||||
/**
|
||||
* This class is used to realize LazyFluentIterables. It decorates a given iterator. Does not
|
||||
* support consecutive hasNext() calls.
|
||||
* @param <E> Iterable Collection of Elements of Type E
|
||||
*/
|
||||
public abstract class DecoratingIterator<E> implements Iterator<E> {
|
||||
|
||||
|
@ -23,7 +23,9 @@
|
||||
package com.iluwatar.fluentinterface.app;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Application Test Entry
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
@ -28,7 +28,12 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
|
||||
/**
|
||||
* Guarded Queue is an implementation for Guarded Suspension Pattern
|
||||
* Guarded suspension pattern is used to handle a situation when you want to execute a method
|
||||
* on an object which is not in a proper state.
|
||||
* @see http://java-design-patterns.com/patterns/guarded-suspension/
|
||||
*/
|
||||
public class GuardedQueue {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class);
|
||||
private final Queue<Integer> sourceList;
|
||||
|
@ -29,6 +29,9 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Test for Guarded Queue
|
||||
*/
|
||||
public class GuardedQueueTest {
|
||||
private volatile Integer value;
|
||||
|
||||
|
@ -29,6 +29,9 @@ package com.iluwatar.hexagonal.domain;
|
||||
*/
|
||||
public class LotteryTicketCheckResult {
|
||||
|
||||
/**
|
||||
* Enumeration of Type of Outcomes of a Lottery
|
||||
*/
|
||||
public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED }
|
||||
|
||||
private final CheckResult checkResult;
|
||||
|
@ -30,6 +30,9 @@ import java.util.HashSet;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Lottery Tickets for equality
|
||||
*/
|
||||
public class LotteryTicketTest {
|
||||
|
||||
@Test
|
||||
|
@ -22,18 +22,19 @@
|
||||
*/
|
||||
package com.iluwatar.interpreter;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/14/15 - 11:48 AM
|
||||
*
|
||||
* Test Case for Expressions
|
||||
* @param <E> Type of Expression
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class ExpressionTest<E extends Expression> {
|
||||
|
@ -22,20 +22,19 @@
|
||||
*/
|
||||
package com.iluwatar.model.view.controller;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Date: 12/20/15 - 2:04 PM
|
||||
*
|
||||
@ -70,6 +69,9 @@ public class GiantViewTest {
|
||||
assertEquals(1, appender.getLogSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging Appender Implementation
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.monad;
|
||||
|
||||
/**
|
||||
* Enumeration of Types of Sex
|
||||
*/
|
||||
public enum Sex {
|
||||
MALE, FEMALE
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.monad;
|
||||
|
||||
/**
|
||||
* User Definition
|
||||
*/
|
||||
public class User {
|
||||
|
||||
private String name;
|
||||
|
@ -24,6 +24,9 @@ package com.iluwatar.monad;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Application Test
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
@ -30,6 +30,9 @@ import org.junit.rules.ExpectedException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Test for Monad Pattern
|
||||
*/
|
||||
public class MonadTest {
|
||||
|
||||
@Rule
|
||||
|
@ -24,6 +24,9 @@ package com.iluwatar.monostate;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Application Test Entry
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
@ -35,6 +35,9 @@ import org.junit.rules.ExpectedException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Test for the mute-idiom pattern
|
||||
*/
|
||||
public class MuteTest {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MuteTest.class);
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.mutex;
|
||||
import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Application Test Entrypoint
|
||||
*/
|
||||
public class AppTest{
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
|
@ -21,6 +21,10 @@ import org.apache.isis.applib.annotation.HomePage;
|
||||
import org.apache.isis.applib.annotation.NatureOfService;
|
||||
import org.apache.isis.applib.annotation.SemanticsOf;
|
||||
|
||||
/**
|
||||
* HomePage Domain Service
|
||||
* @see HomePageViewModel linked view to HomePage
|
||||
*/
|
||||
@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
|
||||
public class HomePageService {
|
||||
|
||||
|
@ -21,6 +21,11 @@ import org.apache.isis.applib.annotation.ViewModel;
|
||||
import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.dom.modules.simple.SimpleObjects;
|
||||
|
||||
/**
|
||||
* Model linked to the HomePage
|
||||
* The underlying layout is specified by json
|
||||
* @see HomePageService - Service Linked to the HomePage
|
||||
*/
|
||||
@ViewModel
|
||||
public class HomePageViewModel {
|
||||
|
||||
|
@ -33,6 +33,9 @@ import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
|
||||
import org.apache.isis.applib.services.i18n.TranslatableString;
|
||||
import org.apache.isis.applib.util.ObjectContracts;
|
||||
|
||||
/**
|
||||
* Definition of a Simple Object
|
||||
*/
|
||||
@javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "simple",
|
||||
table = "SimpleObject")
|
||||
@javax.jdo.annotations.DatastoreIdentity(
|
||||
@ -74,6 +77,9 @@ public class SimpleObject implements Comparable<SimpleObject> {
|
||||
|
||||
// region > updateName (action)
|
||||
|
||||
/**
|
||||
* Event used to update the Name in the Domain
|
||||
*/
|
||||
public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> {
|
||||
public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier,
|
||||
final Object... arguments) {
|
||||
|
@ -30,6 +30,9 @@ import org.apache.isis.applib.query.QueryDefault;
|
||||
import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
|
||||
import org.apache.isis.applib.services.i18n.TranslatableString;
|
||||
|
||||
/**
|
||||
* Domain Service for Simple Objects
|
||||
*/
|
||||
@DomainService(repositoryFor = SimpleObject.class)
|
||||
@DomainServiceLayout(menuOrder = "10")
|
||||
public class SimpleObjects {
|
||||
@ -69,6 +72,9 @@ public class SimpleObjects {
|
||||
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* Create Domain Event on SimpleObjects
|
||||
*/
|
||||
// region > create (action)
|
||||
public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> {
|
||||
public CreateDomainEvent(final SimpleObjects source, final Identifier identifier,
|
||||
|
@ -14,11 +14,14 @@
|
||||
*/
|
||||
package domainapp.dom.modules.simple;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for SimpleObject
|
||||
*/
|
||||
public class SimpleObjectTest {
|
||||
|
||||
SimpleObject simpleObject;
|
||||
@ -28,6 +31,9 @@ public class SimpleObjectTest {
|
||||
simpleObject = new SimpleObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for Names for SimpleObjects
|
||||
*/
|
||||
public static class Name extends SimpleObjectTest {
|
||||
|
||||
@Test
|
||||
|
@ -14,10 +14,13 @@
|
||||
*/
|
||||
package domainapp.dom.modules.simple;
|
||||
|
||||
import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.isis.applib.DomainObjectContainer;
|
||||
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
|
||||
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.Sequence;
|
||||
import org.jmock.auto.Mock;
|
||||
@ -25,12 +28,9 @@ import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.isis.applib.DomainObjectContainer;
|
||||
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
|
||||
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for SimpleObjects
|
||||
*/
|
||||
public class SimpleObjectsTest {
|
||||
|
||||
@Rule
|
||||
@ -47,6 +47,9 @@ public class SimpleObjectsTest {
|
||||
simpleObjects.container = mockContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Creation of Simple Objects
|
||||
*/
|
||||
public static class Create extends SimpleObjectsTest {
|
||||
|
||||
@Test
|
||||
@ -77,6 +80,9 @@ public class SimpleObjectsTest {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Listing of Simple Objects
|
||||
*/
|
||||
public static class ListAll extends SimpleObjectsTest {
|
||||
|
||||
@Test
|
||||
|
@ -20,6 +20,9 @@ import org.apache.isis.applib.fixturescripts.FixtureScript;
|
||||
import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.dom.modules.simple.SimpleObjects;
|
||||
|
||||
/**
|
||||
* Fixture to create a simple object
|
||||
*/
|
||||
public class SimpleObjectCreate extends FixtureScript {
|
||||
|
||||
// endregion
|
||||
|
@ -18,6 +18,9 @@ package domainapp.fixture.modules.simple;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScript;
|
||||
import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
|
||||
|
||||
/**
|
||||
* TearDown/Cleanup for SimpleObjects
|
||||
*/
|
||||
public class SimpleObjectsTearDown extends FixtureScript {
|
||||
|
||||
@javax.inject.Inject
|
||||
|
@ -27,6 +27,10 @@ import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.fixture.modules.simple.SimpleObjectCreate;
|
||||
import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
|
||||
|
||||
|
||||
/**
|
||||
* Create a bunch of simple Objects
|
||||
*/
|
||||
public class RecreateSimpleObjects extends FixtureScript {
|
||||
|
||||
public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz",
|
||||
|
@ -19,6 +19,9 @@ import org.apache.isis.core.integtestsupport.IsisSystemForTest;
|
||||
import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
|
||||
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
|
||||
|
||||
/**
|
||||
* Initializer for the Simple App
|
||||
*/
|
||||
public final class SimpleAppSystemInitializer {
|
||||
|
||||
private SimpleAppSystemInitializer() {
|
||||
|
@ -21,6 +21,9 @@ import cucumber.api.java.After;
|
||||
import cucumber.api.java.Before;
|
||||
import domainapp.integtests.bootstrap.SimpleAppSystemInitializer;
|
||||
|
||||
/**
|
||||
* BootStrapping IntegrationTesting Before and After Steps
|
||||
*/
|
||||
public class BootstrappingGlue extends CukeGlueAbstract {
|
||||
|
||||
@Before(value = {"@integration"}, order = 100)
|
||||
|
@ -19,6 +19,9 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
|
||||
import cucumber.api.java.Before;
|
||||
import domainapp.fixture.scenarios.RecreateSimpleObjects;
|
||||
|
||||
/**
|
||||
* Test Execution to append a fixture of SimpleObjects
|
||||
*/
|
||||
public class CatalogOfFixturesGlue extends CukeGlueAbstract {
|
||||
|
||||
@Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000)
|
||||
|
@ -14,18 +14,20 @@
|
||||
*/
|
||||
package domainapp.integtests.specglue.modules.simple;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import cucumber.api.java.en.Given;
|
||||
import cucumber.api.java.en.When;
|
||||
import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.dom.modules.simple.SimpleObjects;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
|
||||
|
||||
/**
|
||||
* Test Simple Object Operations
|
||||
*/
|
||||
public class SimpleObjectGlue extends CukeGlueAbstract {
|
||||
|
||||
@Given("^there are.* (\\d+) simple objects$")
|
||||
|
@ -25,6 +25,9 @@ import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForInteg
|
||||
|
||||
import domainapp.integtests.bootstrap.SimpleAppSystemInitializer;
|
||||
|
||||
/**
|
||||
* SimpleApp Integration Tests will implement this Abstract Class.
|
||||
*/
|
||||
public abstract class SimpleAppIntegTest extends IntegrationTestAbstract {
|
||||
|
||||
@BeforeClass
|
||||
@ -35,5 +38,4 @@ public abstract class SimpleAppIntegTest extends IntegrationTestAbstract {
|
||||
// instantiating will install onto ThreadLocal
|
||||
new ScenarioExecutionForIntegration();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,21 +18,22 @@
|
||||
*/
|
||||
package domainapp.integtests.tests.modules.simple;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.isis.applib.DomainObjectContainer;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScripts;
|
||||
import org.apache.isis.applib.services.wrapper.DisabledException;
|
||||
import org.apache.isis.applib.services.wrapper.InvalidException;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.fixture.scenarios.RecreateSimpleObjects;
|
||||
import domainapp.integtests.tests.SimpleAppIntegTest;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import javax.inject.Inject;
|
||||
import org.apache.isis.applib.DomainObjectContainer;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScripts;
|
||||
import org.apache.isis.applib.services.wrapper.DisabledException;
|
||||
import org.apache.isis.applib.services.wrapper.InvalidException;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Fixtures with Simple Objects
|
||||
*/
|
||||
public class SimpleObjectIntegTest extends SimpleAppIntegTest {
|
||||
|
||||
@Inject
|
||||
@ -54,6 +55,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
|
||||
simpleObjectWrapped = wrap(simpleObjectPojo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Object Name accessibility
|
||||
*/
|
||||
public static class Name extends SimpleObjectIntegTest {
|
||||
|
||||
@Test
|
||||
@ -75,6 +79,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Validation of SimpleObject Names
|
||||
*/
|
||||
public static class UpdateName extends SimpleObjectIntegTest {
|
||||
|
||||
@Test
|
||||
@ -99,6 +106,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ContainerTitle generation based on SimpleObject Name
|
||||
*/
|
||||
public static class Title extends SimpleObjectIntegTest {
|
||||
|
||||
@Inject
|
||||
|
@ -18,28 +18,27 @@
|
||||
*/
|
||||
package domainapp.integtests.tests.modules.simple;
|
||||
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScript;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScripts;
|
||||
|
||||
import domainapp.dom.modules.simple.SimpleObject;
|
||||
import domainapp.dom.modules.simple.SimpleObjects;
|
||||
import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
|
||||
import domainapp.fixture.scenarios.RecreateSimpleObjects;
|
||||
import domainapp.integtests.tests.SimpleAppIntegTest;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScript;
|
||||
import org.apache.isis.applib.fixturescripts.FixtureScripts;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Fixture Pattern Integration Test
|
||||
*/
|
||||
public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
|
||||
|
||||
@Inject
|
||||
@ -47,6 +46,9 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
|
||||
@Inject
|
||||
SimpleObjects simpleObjects;
|
||||
|
||||
/**
|
||||
* Test Listing of All Simple Objects
|
||||
*/
|
||||
public static class ListAll extends SimpleObjectsIntegTest {
|
||||
|
||||
@Test
|
||||
@ -83,6 +85,10 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test Creation of Simple Objects
|
||||
*/
|
||||
public static class Create extends SimpleObjectsIntegTest {
|
||||
|
||||
@Test
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.objectmother;
|
||||
|
||||
/**
|
||||
* Defines all attributes and behaviour related to the King
|
||||
*/
|
||||
public class King implements Royalty {
|
||||
boolean isDrunk = false;
|
||||
boolean isHappy = false;
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.objectmother;
|
||||
|
||||
/**
|
||||
* Defines all attributes and behaviour related to the Queen
|
||||
*/
|
||||
public class Queen implements Royalty {
|
||||
private boolean isDrunk = false;
|
||||
private boolean isHappy = false;
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.objectmother;
|
||||
|
||||
/**
|
||||
* Interface contracting Royalty Behaviour
|
||||
*/
|
||||
public interface Royalty {
|
||||
void makeDrunk();
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.objectmother;
|
||||
|
||||
/**
|
||||
* Object Mother Pattern generating Royalty Types
|
||||
*/
|
||||
public final class RoyaltyObjectMother {
|
||||
|
||||
/**
|
||||
|
@ -33,6 +33,9 @@ import com.iluwatar.objectmother.Queen;
|
||||
import com.iluwatar.objectmother.Royalty;
|
||||
import com.iluwatar.objectmother.RoyaltyObjectMother;
|
||||
|
||||
/**
|
||||
* Test Generation of Royalty Types using the object-mother
|
||||
*/
|
||||
public class RoyaltyObjectMotherTest {
|
||||
|
||||
@Test
|
||||
|
@ -26,8 +26,8 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* Generic object pool
|
||||
* @param <T> Type T of Object in the Pool
|
||||
*/
|
||||
public abstract class ObjectPool<T> {
|
||||
|
||||
|
@ -23,8 +23,10 @@
|
||||
package com.iluwatar.observer.generic;
|
||||
|
||||
/**
|
||||
*
|
||||
* Observer
|
||||
* @param <S> Observable
|
||||
* @param <O> Observer
|
||||
* @param <A> Action
|
||||
*/
|
||||
public interface Observer<S extends Observable<S, O, A>, O extends Observer<S, O, A>, A> {
|
||||
|
||||
|
@ -22,18 +22,18 @@
|
||||
*/
|
||||
package com.iluwatar.observer;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.iluwatar.observer.utils.InMemoryAppender;
|
||||
import java.util.function.Supplier;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 11:44 AM
|
||||
*
|
||||
* Weather Observer Tests
|
||||
* @param <O> Type of WeatherObserver
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class WeatherObserverTest<O extends WeatherObserver> {
|
||||
|
@ -22,19 +22,19 @@
|
||||
*/
|
||||
package com.iluwatar.observer.generic;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import com.iluwatar.observer.WeatherType;
|
||||
import com.iluwatar.observer.utils.InMemoryAppender;
|
||||
import java.util.function.Supplier;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Date: 12/27/15 - 11:44 AM
|
||||
*
|
||||
* Test for Observers
|
||||
* @param <O> Type of Observer
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class ObserverTest<O extends Observer> {
|
||||
|
@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -23,15 +23,17 @@
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.AlbumPage;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
* Test Album Selection and Album Listing
|
||||
*/
|
||||
public class AlbumListPageTest {
|
||||
|
||||
private AlbumListPage albumListPage = new AlbumListPage(new WebClient());
|
||||
|
@ -22,14 +22,17 @@
|
||||
*/
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.AlbumPage;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Album Page Operations
|
||||
*/
|
||||
public class AlbumPageTest {
|
||||
|
||||
private AlbumPage albumPage = new AlbumPage(new WebClient());
|
||||
|
@ -22,14 +22,17 @@
|
||||
*/
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.LoginPage;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Login Page Object
|
||||
*/
|
||||
public class LoginPageTest {
|
||||
|
||||
private LoginPage loginPage = new LoginPage(new WebClient());
|
||||
|
@ -63,6 +63,9 @@ public interface Message {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration of Type of Headers
|
||||
*/
|
||||
public enum Headers {
|
||||
DATE, SENDER
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -39,6 +39,9 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Utility to perform various operations
|
||||
*/
|
||||
public class Utility {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Utility.class);
|
||||
|
@ -30,6 +30,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class Character implements Prototype {
|
||||
|
||||
/**
|
||||
* Enumeration of Character types
|
||||
*/
|
||||
public enum Type {
|
||||
WARRIOR, MAGE, ROGUE
|
||||
}
|
||||
|
@ -22,21 +22,20 @@
|
||||
*/
|
||||
package com.iluwatar.prototype;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
/**
|
||||
* Date: 12/28/15 - 8:45 PM
|
||||
*
|
||||
* @param <P> Prototype
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
|
@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -34,6 +34,9 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
*/
|
||||
public class PersonSpecifications {
|
||||
|
||||
/**
|
||||
* Specifications stating the Between (From - To) Age Specification
|
||||
*/
|
||||
public static class AgeBetweenSpec implements Specification<Person> {
|
||||
|
||||
private int from;
|
||||
|
@ -22,19 +22,18 @@
|
||||
*/
|
||||
package com.iluwatar.resource.acquisition.is.initialization;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/28/15 - 9:31 PM
|
||||
*
|
||||
@ -64,6 +63,9 @@ public class ClosableTest {
|
||||
assertTrue(appender.logContains("Sliding door closes."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging Appender Implementation
|
||||
*/
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
@ -27,6 +27,9 @@ package com.iluwatar.semaphore;
|
||||
*/
|
||||
public class Fruit {
|
||||
|
||||
/**
|
||||
* Enumeration of Fruit Types
|
||||
*/
|
||||
public static enum FruitType {
|
||||
ORANGE, APPLE, LEMON
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ package com.iluwatar.semaphore;
|
||||
import org.junit.Test;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Application Test Entrypoint
|
||||
*/
|
||||
public class AppTest{
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
|
@ -22,23 +22,23 @@
|
||||
*/
|
||||
package com.iluwatar.servicelayer.common;
|
||||
|
||||
import com.iluwatar.servicelayer.hibernate.HibernateUtil;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import com.iluwatar.servicelayer.hibernate.HibernateUtil;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/28/15 - 10:53 PM
|
||||
*
|
||||
* Test for Base Data Access Objects
|
||||
* @param <E> Type of Base Entity
|
||||
* @param <D> Type of Dao Base Implementation
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class BaseDaoTest<E extends BaseEntity, D extends DaoBaseImpl<E>> {
|
||||
|
@ -22,7 +22,8 @@
|
||||
*/
|
||||
package com.iluwatar.singleton;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -31,9 +32,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* This class provides several test case that test singleton construction.
|
||||
@ -43,7 +42,7 @@ import static org.junit.Assert.assertSame;
|
||||
* the same when called in the DIFFERENT thread.
|
||||
*
|
||||
* Date: 12/29/15 - 19:25 PM
|
||||
*
|
||||
* @param <S> Supplier method generating singletons
|
||||
* @author Jeroen Meulemeester
|
||||
* @author Richard Jones
|
||||
*/
|
||||
|
@ -22,23 +22,22 @@
|
||||
*/
|
||||
package com.iluwatar.templatemethod;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Date: 12/30/15 - 18:12 PM
|
||||
*
|
||||
* @param <M> Type of StealingMethod
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class StealingMethodTest<M extends StealingMethod> {
|
||||
|
@ -22,7 +22,8 @@
|
||||
*/
|
||||
package com.iluwatar.threadpool;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -34,13 +35,12 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/30/15 - 18:22 PM
|
||||
*
|
||||
* Test for Tasks using a Thread Pool
|
||||
* @param <T> Type of Task
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public abstract class TaskTest<T extends Task> {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user