Merge pull request #548 from muditporwal/master

Checkstyle improvements #539 : Added JavaDocType Rule
This commit is contained in:
Ilkka Seppälä 2017-04-01 14:45:52 +03:00 committed by GitHub
commit 3f272bf291
103 changed files with 575 additions and 282 deletions

View File

@ -28,6 +28,9 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* Test for abstract factory
*/
public class AbstractFactoryTest { public class AbstractFactoryTest {
private App app = new App(); private App app = new App();

View File

@ -25,6 +25,9 @@ package com.iluwatar.aggregator.microservices;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Spring Boot EntryPoint Class
*/
@SpringBootApplication @SpringBootApplication
public class App { public class App {

View File

@ -22,15 +22,18 @@
*/ */
package com.iluwatar.aggregator.microservices; package com.iluwatar.aggregator.microservices;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals; /**
import static org.mockito.Mockito.when; * Test Aggregation of domain objects
*/
public class AggregatorTest { public class AggregatorTest {
@InjectMocks @InjectMocks

View File

@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/**
* Controller providing endpoints to retrieve information about products
*/
@RestController @RestController
public class InformationController { public class InformationController {

View File

@ -25,6 +25,9 @@ package com.iluwatar.information.microservice;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/**
* Test for Information Rest Controller
*/
public class InformationControllerTest { public class InformationControllerTest {
@Test @Test

View File

@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/**
* Controller providing endpoints to retrieve product inventories
*/
@RestController @RestController
public class InventoryController { public class InventoryController {

View File

@ -25,8 +25,10 @@ package com.iluwatar.inventory.microservice;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/**
* Test Inventory Rest Controller
*/
public class InventoryControllerTest { public class InventoryControllerTest {
@Test @Test
public void testGetProductInventories() throws Exception { public void testGetProductInventories() throws Exception {
InventoryController inventoryController = new InventoryController(); InventoryController inventoryController = new InventoryController();

View File

@ -22,15 +22,18 @@
*/ */
package com.iluwatar.api.gateway; package com.iluwatar.api.gateway;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals; /**
import static org.mockito.Mockito.when; * Test API Gateway Pattern
*/
public class ApiGatewayTest { public class ApiGatewayTest {
@InjectMocks @InjectMocks

View File

@ -25,6 +25,9 @@ package com.iluwatar.image.microservice;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/**
* Test for Image Rest Controller
*/
public class ImageControllerTest { public class ImageControllerTest {
@Test @Test
public void testGetImagePath() { public void testGetImagePath() {

View File

@ -25,6 +25,10 @@ package com.iluwatar.price.microservice;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/**
* Test for Price Rest Controller
*/
public class PriceControllerTest { public class PriceControllerTest {
@Test @Test
public void testgetPrice() { public void testgetPrice() {

View File

@ -25,8 +25,8 @@ package com.iluwatar.async.method.invocation;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
/** /**
*
* AsyncResult interface * AsyncResult interface
* @param <T> parameter returned when getValue is invoked
*/ */
public interface AsyncResult<T> { public interface AsyncResult<T> {

View File

@ -77,7 +77,6 @@
<property name="max" value="120"/> <property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module> </module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/> <module name="OneTopLevelClass"/>
<module name="NoLineWrap"/> <module name="NoLineWrap"/>
<module name="EmptyBlock"> <module name="EmptyBlock">
@ -185,6 +184,10 @@
<property name="allowedAnnotations" value="Override, Test, Before, After, Parameters, Given, When, BeforeClass, AfterClass, Parameterized"/> <property name="allowedAnnotations" value="Override, Test, Before, After, Parameters, Given, When, BeforeClass, AfterClass, Parameterized"/>
<property name="allowThrowsTagsForSubclasses" value="true"/> <property name="allowThrowsTagsForSubclasses" value="true"/>
</module> </module>
<module name="JavadocType">
<property name="scope" value="public"/>
<property name="allowUnknownTags" value="true"/>
</module>
<module name="MethodName"> <module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/> <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern" <message key="name.invalidPattern"

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.dao; package com.iluwatar.dao;
/**
* Customer Schema SQL Class
*/
public final class CustomerSchemaSql { public final class CustomerSchemaSql {
private CustomerSchemaSql() {} private CustomerSchemaSql() {}

View File

@ -29,6 +29,9 @@ import static org.junit.Assert.assertNotEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* Tests {@link Customer}.
*/
public class CustomerTest { public class CustomerTest {
private Customer customer; private Customer customer;

View File

@ -21,6 +21,9 @@ package com.iluwatar.datamapper;
import java.io.Serializable; import java.io.Serializable;
/**
* Class defining Student
*/
public final class Student implements Serializable { public final class Student implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -20,6 +20,9 @@ package com.iluwatar.datamapper;
import java.util.Optional; import java.util.Optional;
/**
* Interface lists out the possible behaviour for all possible student mappers
*/
public interface StudentDataMapper { public interface StudentDataMapper {
Optional<Student> find(int studentId); Optional<Student> find(int studentId);

View File

@ -22,6 +22,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
/**
* Implementation of Actions on Students Data
*/
public final class StudentDataMapperImpl implements StudentDataMapper { public final class StudentDataMapperImpl implements StudentDataMapper {
/* Note: Normally this would be in the form of an actual database */ /* Note: Normally this would be in the form of an actual database */

View File

@ -18,10 +18,14 @@
*/ */
package com.iluwatar.datamapper; 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.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Tests {@link Student}.
*/
public final class StudentTest { public final class StudentTest {
@Test @Test

View File

@ -22,6 +22,12 @@
*/ */
package com.iluwatar.delegation.simple; 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 { public class PrinterController implements Printer {
private final Printer printer; private final Printer printer;

View File

@ -23,7 +23,9 @@
package com.iluwatar.delegation.simple; package com.iluwatar.delegation.simple;
import org.junit.Test; import org.junit.Test;
/**
* Application Test Entry
*/
public class AppTest { public class AppTest {
@Test @Test

View File

@ -22,22 +22,24 @@
*/ */
package com.iluwatar.delegation.simple; package com.iluwatar.delegation.simple;
import static org.junit.Assert.assertEquals;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.AppenderBase;
import com.iluwatar.delegation.simple.printers.CanonPrinter; import com.iluwatar.delegation.simple.printers.CanonPrinter;
import com.iluwatar.delegation.simple.printers.EpsonPrinter; import com.iluwatar.delegation.simple.printers.EpsonPrinter;
import com.iluwatar.delegation.simple.printers.HpPrinter; import com.iluwatar.delegation.simple.printers.HpPrinter;
import java.util.LinkedList;
import java.util.List;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.LinkedList; /**
import java.util.List; * Test for Delegation Pattern
*/
import static org.junit.Assert.assertEquals;
public class DelegateTest { public class DelegateTest {
private InMemoryAppender appender; private InMemoryAppender appender;
@ -78,6 +80,9 @@ public class DelegateTest {
assertEquals("Epson Printer : Test Message Printed", appender.getLastMessage()); assertEquals("Epson Printer : Test Message Printed", appender.getLastMessage());
} }
/**
* Logging Appender
*/
private class InMemoryAppender extends AppenderBase<ILoggingEvent> { private class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -22,13 +22,14 @@
*/ */
package com.iluwatar.doubledispatch; package com.iluwatar.doubledispatch;
import java.util.Objects;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.util.Objects;
/** /**
* Date: 12/10/15 - 8:37 PM * Date: 12/10/15 - 8:37 PM
* * Test for Collision
* @param <O> Type of GameObject
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class CollisionTest<O extends GameObject> { public abstract class CollisionTest<O extends GameObject> {

View File

@ -22,22 +22,22 @@
*/ */
package com.iluwatar.event.aggregator; 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.Matchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions; 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 * Date: 12/12/15 - 10:58 PM
* * Tests for Event Emitter
* @param <E> Type of Event Emitter
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class EventEmitterTest<E extends EventEmitter> { public abstract class EventEmitterTest<E extends EventEmitter> {

View File

@ -16,6 +16,9 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Custom Exception Class for Non Existent Event
*/
public class EventDoesNotExistException extends Exception { public class EventDoesNotExistException extends Exception {
private static final long serialVersionUID = -3398463738273811509L; private static final long serialVersionUID = -3398463738273811509L;

View File

@ -16,6 +16,10 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Events that fulfill the start stop and list out current status behaviour
* follow this interface
*/
public interface IEvent { public interface IEvent {
void start(); void start();

View File

@ -16,6 +16,9 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Type of Exception raised when the Operation being invoked is Invalid
*/
public class InvalidOperationException extends Exception { public class InvalidOperationException extends Exception {
private static final long serialVersionUID = -6191545255213410803L; private static final long serialVersionUID = -6191545255213410803L;

View File

@ -16,6 +16,9 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Type of Exception raised when the Operation being invoked is Long Running
*/
public class LongRunningEventException extends Exception { public class LongRunningEventException extends Exception {
private static final long serialVersionUID = -483423544320148809L; private static final long serialVersionUID = -483423544320148809L;

View File

@ -16,6 +16,9 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Type of Exception raised when the max number of allowed events is exceeded
*/
public class MaxNumOfEventsAllowedException extends Exception { public class MaxNumOfEventsAllowedException extends Exception {
private static final long serialVersionUID = -8430876973516292695L; private static final long serialVersionUID = -8430876973516292695L;

View File

@ -16,6 +16,9 @@
*/ */
package com.iluwatar.event.asynchronous; package com.iluwatar.event.asynchronous;
/**
* Interface with listener behaviour related to Thread Completion.
*/
public interface ThreadCompleteListener { public interface ThreadCompleteListener {
void completedEventHandler(final int eventId); void completedEventHandler(final int eventId);
} }

View File

@ -25,6 +25,7 @@ package com.iluwatar.eda.framework;
/** /**
* This interface can be implemented to handle different types of messages. * This interface can be implemented to handle different types of messages.
* Every handler is responsible for a single of type message * 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> { public interface Handler<E extends Event> {

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.factorykit; package com.iluwatar.factorykit;
/**
* Class representing Axe
*/
public class Axe implements Weapon { public class Axe implements Weapon {
@Override @Override
public String toString() { public String toString() {

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.factorykit; package com.iluwatar.factorykit;
/**
* Class representing Bows
*/
public class Bow implements Weapon { public class Bow implements Weapon {
@Override @Override
public String toString() { public String toString() {

View File

@ -21,7 +21,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package com.iluwatar.factorykit; package com.iluwatar.factorykit;
/**
* Class representing Spear
*/
public class Spear implements Weapon { public class Spear implements Weapon {
@Override @Override
public String toString() { public String toString() {

View File

@ -21,7 +21,9 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package com.iluwatar.factorykit; package com.iluwatar.factorykit;
/**
* Class representing Swords
*/
public class Sword implements Weapon { public class Sword implements Weapon {
@Override @Override
public String toString() { public String toString() {

View File

@ -25,6 +25,9 @@ package com.iluwatar.factorykit.app;
import com.iluwatar.factorykit.App; import com.iluwatar.factorykit.App;
import org.junit.Test; import org.junit.Test;
/**
* Application Test Entrypoint
*/
public class AppTest { public class AppTest {
@Test @Test

View File

@ -1,4 +1,4 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014-2016 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
@ -22,12 +22,19 @@
*/ */
package com.iluwatar.factorykit.factorykit; package com.iluwatar.factorykit.factorykit;
import com.iluwatar.factorykit.*;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertTrue; 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 { public class FactoryKitTest {
private WeaponFactory factory; private WeaponFactory factory;

View File

@ -23,16 +23,18 @@
package com.iluwatar.featuretoggle.pattern.propertiesversion; 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.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; 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 { public class PropertiesFeatureToggleVersionTest {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)

View File

@ -22,15 +22,18 @@
*/ */
package com.iluwatar.featuretoggle.pattern.tieredversion; 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.pattern.Service;
import com.iluwatar.featuretoggle.user.User; import com.iluwatar.featuretoggle.user.User;
import com.iluwatar.featuretoggle.user.UserGroup; import com.iluwatar.featuretoggle.user.UserGroup;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; /**
import static org.junit.Assert.assertTrue; * Test Tiered Feature Toggle
*/
public class TieredFeatureToggleVersionTest { public class TieredFeatureToggleVersionTest {
final User paidUser = new User("Jamie Coder"); final User paidUser = new User("Jamie Coder");

View File

@ -22,11 +22,14 @@
*/ */
package com.iluwatar.featuretoggle.user; package com.iluwatar.featuretoggle.user;
import org.junit.Test;
import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Test User Group specific feature
*/
public class UserGroupTest { public class UserGroupTest {
@Test @Test

View File

@ -27,6 +27,7 @@ import java.util.Iterator;
/** /**
* This class is used to realize LazyFluentIterables. It decorates a given iterator. Does not * This class is used to realize LazyFluentIterables. It decorates a given iterator. Does not
* support consecutive hasNext() calls. * support consecutive hasNext() calls.
* @param <E> Iterable Collection of Elements of Type E
*/ */
public abstract class DecoratingIterator<E> implements Iterator<E> { public abstract class DecoratingIterator<E> implements Iterator<E> {

View File

@ -23,7 +23,9 @@
package com.iluwatar.fluentinterface.app; package com.iluwatar.fluentinterface.app;
import org.junit.Test; import org.junit.Test;
/**
* Application Test Entry
*/
public class AppTest { public class AppTest {
@Test @Test

View File

@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -28,7 +28,12 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Queue; 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 { public class GuardedQueue {
private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class); private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class);
private final Queue<Integer> sourceList; private final Queue<Integer> sourceList;

View File

@ -29,6 +29,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/**
* Test for Guarded Queue
*/
public class GuardedQueueTest { public class GuardedQueueTest {
private volatile Integer value; private volatile Integer value;

View File

@ -29,6 +29,9 @@ package com.iluwatar.hexagonal.domain;
*/ */
public class LotteryTicketCheckResult { public class LotteryTicketCheckResult {
/**
* Enumeration of Type of Outcomes of a Lottery
*/
public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED } public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED }
private final CheckResult checkResult; private final CheckResult checkResult;

View File

@ -30,6 +30,9 @@ import java.util.HashSet;
import org.junit.Test; import org.junit.Test;
/**
* Test Lottery Tickets for equality
*/
public class LotteryTicketTest { public class LotteryTicketTest {
@Test @Test

View File

@ -22,18 +22,19 @@
*/ */
package com.iluwatar.interpreter; 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.ArrayList;
import java.util.List; import java.util.List;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/** /**
* Date: 12/14/15 - 11:48 AM * Date: 12/14/15 - 11:48 AM
* *
* Test Case for Expressions
* @param <E> Type of Expression
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class ExpressionTest<E extends Expression> { public abstract class ExpressionTest<E extends Expression> {

View File

@ -22,20 +22,19 @@
*/ */
package com.iluwatar.model.view.controller; 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.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.AppenderBase;
import java.util.LinkedList;
import java.util.List;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; 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 * Date: 12/20/15 - 2:04 PM
* *
@ -70,6 +69,9 @@ public class GiantViewTest {
assertEquals(1, appender.getLogSize()); assertEquals(1, appender.getLogSize());
} }
/**
* Logging Appender Implementation
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.monad; package com.iluwatar.monad;
/**
* Enumeration of Types of Sex
*/
public enum Sex { public enum Sex {
MALE, FEMALE MALE, FEMALE
} }

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.monad; package com.iluwatar.monad;
/**
* User Definition
*/
public class User { public class User {
private String name; private String name;

View File

@ -24,6 +24,9 @@ package com.iluwatar.monad;
import org.junit.Test; import org.junit.Test;
/**
* Application Test
*/
public class AppTest { public class AppTest {
@Test @Test

View File

@ -30,6 +30,9 @@ import org.junit.rules.ExpectedException;
import java.util.Objects; import java.util.Objects;
/**
* Test for Monad Pattern
*/
public class MonadTest { public class MonadTest {
@Rule @Rule

View File

@ -24,6 +24,9 @@ package com.iluwatar.monostate;
import org.junit.Test; import org.junit.Test;
/**
* Application Test Entry
*/
public class AppTest { public class AppTest {
@Test @Test

View File

@ -35,6 +35,9 @@ import org.junit.rules.ExpectedException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/**
* Test for the mute-idiom pattern
*/
public class MuteTest { public class MuteTest {
private static final Logger LOGGER = LoggerFactory.getLogger(MuteTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(MuteTest.class);

View File

@ -25,6 +25,9 @@ package com.iluwatar.mutex;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
/**
* Application Test Entrypoint
*/
public class AppTest{ public class AppTest{
@Test @Test
public void test() throws IOException { public void test() throws IOException {

View File

@ -21,6 +21,10 @@ import org.apache.isis.applib.annotation.HomePage;
import org.apache.isis.applib.annotation.NatureOfService; import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.SemanticsOf; import org.apache.isis.applib.annotation.SemanticsOf;
/**
* HomePage Domain Service
* @see HomePageViewModel linked view to HomePage
*/
@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) @DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
public class HomePageService { public class HomePageService {

View File

@ -21,6 +21,11 @@ import org.apache.isis.applib.annotation.ViewModel;
import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects; 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 @ViewModel
public class HomePageViewModel { public class HomePageViewModel {

View File

@ -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.services.i18n.TranslatableString;
import org.apache.isis.applib.util.ObjectContracts; import org.apache.isis.applib.util.ObjectContracts;
/**
* Definition of a Simple Object
*/
@javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "simple", @javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "simple",
table = "SimpleObject") table = "SimpleObject")
@javax.jdo.annotations.DatastoreIdentity( @javax.jdo.annotations.DatastoreIdentity(
@ -74,6 +77,9 @@ public class SimpleObject implements Comparable<SimpleObject> {
// region > updateName (action) // region > updateName (action)
/**
* Event used to update the Name in the Domain
*/
public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> { public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> {
public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier, public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier,
final Object... arguments) { final Object... arguments) {

View File

@ -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.eventbus.ActionDomainEvent;
import org.apache.isis.applib.services.i18n.TranslatableString; import org.apache.isis.applib.services.i18n.TranslatableString;
/**
* Domain Service for Simple Objects
*/
@DomainService(repositoryFor = SimpleObject.class) @DomainService(repositoryFor = SimpleObject.class)
@DomainServiceLayout(menuOrder = "10") @DomainServiceLayout(menuOrder = "10")
public class SimpleObjects { public class SimpleObjects {
@ -69,6 +72,9 @@ public class SimpleObjects {
// endregion // endregion
/**
* Create Domain Event on SimpleObjects
*/
// region > create (action) // region > create (action)
public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> { public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> {
public CreateDomainEvent(final SimpleObjects source, final Identifier identifier, public CreateDomainEvent(final SimpleObjects source, final Identifier identifier,

View File

@ -14,11 +14,14 @@
*/ */
package domainapp.dom.modules.simple; package domainapp.dom.modules.simple;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat; /**
* Test for SimpleObject
*/
public class SimpleObjectTest { public class SimpleObjectTest {
SimpleObject simpleObject; SimpleObject simpleObject;
@ -28,6 +31,9 @@ public class SimpleObjectTest {
simpleObject = new SimpleObject(); simpleObject = new SimpleObject();
} }
/**
* Test for Names for SimpleObjects
*/
public static class Name extends SimpleObjectTest { public static class Name extends SimpleObjectTest {
@Test @Test

View File

@ -14,10 +14,13 @@
*/ */
package domainapp.dom.modules.simple; package domainapp.dom.modules.simple;
import java.util.List; import static org.assertj.core.api.Assertions.assertThat;
import com.google.common.collect.Lists; 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.Expectations;
import org.jmock.Sequence; import org.jmock.Sequence;
import org.jmock.auto.Mock; import org.jmock.auto.Mock;
@ -25,12 +28,9 @@ import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.apache.isis.applib.DomainObjectContainer; /**
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; * Test for SimpleObjects
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; */
import static org.assertj.core.api.Assertions.assertThat;
public class SimpleObjectsTest { public class SimpleObjectsTest {
@Rule @Rule
@ -47,6 +47,9 @@ public class SimpleObjectsTest {
simpleObjects.container = mockContainer; simpleObjects.container = mockContainer;
} }
/**
* Test Creation of Simple Objects
*/
public static class Create extends SimpleObjectsTest { public static class Create extends SimpleObjectsTest {
@Test @Test
@ -77,6 +80,9 @@ public class SimpleObjectsTest {
} }
/**
* Test Listing of Simple Objects
*/
public static class ListAll extends SimpleObjectsTest { public static class ListAll extends SimpleObjectsTest {
@Test @Test

View File

@ -20,6 +20,9 @@ import org.apache.isis.applib.fixturescripts.FixtureScript;
import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects; import domainapp.dom.modules.simple.SimpleObjects;
/**
* Fixture to create a simple object
*/
public class SimpleObjectCreate extends FixtureScript { public class SimpleObjectCreate extends FixtureScript {
// endregion // endregion

View File

@ -18,6 +18,9 @@ package domainapp.fixture.modules.simple;
import org.apache.isis.applib.fixturescripts.FixtureScript; import org.apache.isis.applib.fixturescripts.FixtureScript;
import org.apache.isis.applib.services.jdosupport.IsisJdoSupport; import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
/**
* TearDown/Cleanup for SimpleObjects
*/
public class SimpleObjectsTearDown extends FixtureScript { public class SimpleObjectsTearDown extends FixtureScript {
@javax.inject.Inject @javax.inject.Inject

View File

@ -27,6 +27,10 @@ import domainapp.dom.modules.simple.SimpleObject;
import domainapp.fixture.modules.simple.SimpleObjectCreate; import domainapp.fixture.modules.simple.SimpleObjectCreate;
import domainapp.fixture.modules.simple.SimpleObjectsTearDown; import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
/**
* Create a bunch of simple Objects
*/
public class RecreateSimpleObjects extends FixtureScript { public class RecreateSimpleObjects extends FixtureScript {
public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz", public final List<String> names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz",

View File

@ -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.DataNucleusPersistenceMechanismInstaller;
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests; import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
/**
* Initializer for the Simple App
*/
public final class SimpleAppSystemInitializer { public final class SimpleAppSystemInitializer {
private SimpleAppSystemInitializer() { private SimpleAppSystemInitializer() {

View File

@ -21,6 +21,9 @@ import cucumber.api.java.After;
import cucumber.api.java.Before; import cucumber.api.java.Before;
import domainapp.integtests.bootstrap.SimpleAppSystemInitializer; import domainapp.integtests.bootstrap.SimpleAppSystemInitializer;
/**
* BootStrapping IntegrationTesting Before and After Steps
*/
public class BootstrappingGlue extends CukeGlueAbstract { public class BootstrappingGlue extends CukeGlueAbstract {
@Before(value = {"@integration"}, order = 100) @Before(value = {"@integration"}, order = 100)

View File

@ -19,6 +19,9 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
import cucumber.api.java.Before; import cucumber.api.java.Before;
import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.fixture.scenarios.RecreateSimpleObjects;
/**
* Test Execution to append a fixture of SimpleObjects
*/
public class CatalogOfFixturesGlue extends CukeGlueAbstract { public class CatalogOfFixturesGlue extends CukeGlueAbstract {
@Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000) @Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000)

View File

@ -14,18 +14,20 @@
*/ */
package domainapp.integtests.specglue.modules.simple; package domainapp.integtests.specglue.modules.simple;
import java.util.List; import static org.hamcrest.CoreMatchers.is;
import java.util.UUID; import static org.junit.Assert.assertThat;
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
import cucumber.api.java.en.Given; import cucumber.api.java.en.Given;
import cucumber.api.java.en.When; import cucumber.api.java.en.When;
import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects; import domainapp.dom.modules.simple.SimpleObjects;
import static org.hamcrest.CoreMatchers.is; import java.util.List;
import static org.junit.Assert.assertThat; import java.util.UUID;
import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
/**
* Test Simple Object Operations
*/
public class SimpleObjectGlue extends CukeGlueAbstract { public class SimpleObjectGlue extends CukeGlueAbstract {
@Given("^there are.* (\\d+) simple objects$") @Given("^there are.* (\\d+) simple objects$")

View File

@ -25,6 +25,9 @@ import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForInteg
import domainapp.integtests.bootstrap.SimpleAppSystemInitializer; import domainapp.integtests.bootstrap.SimpleAppSystemInitializer;
/**
* SimpleApp Integration Tests will implement this Abstract Class.
*/
public abstract class SimpleAppIntegTest extends IntegrationTestAbstract { public abstract class SimpleAppIntegTest extends IntegrationTestAbstract {
@BeforeClass @BeforeClass
@ -35,5 +38,4 @@ public abstract class SimpleAppIntegTest extends IntegrationTestAbstract {
// instantiating will install onto ThreadLocal // instantiating will install onto ThreadLocal
new ScenarioExecutionForIntegration(); new ScenarioExecutionForIntegration();
} }
} }

View File

@ -18,21 +18,22 @@
*/ */
package domainapp.integtests.tests.modules.simple; package domainapp.integtests.tests.modules.simple;
import javax.inject.Inject; import static org.assertj.core.api.Assertions.assertThat;
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 domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObject;
import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest; 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 { public class SimpleObjectIntegTest extends SimpleAppIntegTest {
@Inject @Inject
@ -54,6 +55,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
simpleObjectWrapped = wrap(simpleObjectPojo); simpleObjectWrapped = wrap(simpleObjectPojo);
} }
/**
* Test Object Name accessibility
*/
public static class Name extends SimpleObjectIntegTest { public static class Name extends SimpleObjectIntegTest {
@Test @Test
@ -75,6 +79,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
} }
/**
* Test Validation of SimpleObject Names
*/
public static class UpdateName extends SimpleObjectIntegTest { public static class UpdateName extends SimpleObjectIntegTest {
@Test @Test
@ -99,6 +106,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest {
} }
} }
/**
* Test ContainerTitle generation based on SimpleObject Name
*/
public static class Title extends SimpleObjectIntegTest { public static class Title extends SimpleObjectIntegTest {
@Inject @Inject

View File

@ -18,28 +18,27 @@
*/ */
package domainapp.integtests.tests.modules.simple; package domainapp.integtests.tests.modules.simple;
import java.sql.SQLIntegrityConstraintViolationException; import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import javax.inject.Inject;
import com.google.common.base.Throwables; 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.SimpleObject;
import domainapp.dom.modules.simple.SimpleObjects; import domainapp.dom.modules.simple.SimpleObjects;
import domainapp.fixture.modules.simple.SimpleObjectsTearDown; import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest; 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 { public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
@Inject @Inject
@ -47,6 +46,9 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
@Inject @Inject
SimpleObjects simpleObjects; SimpleObjects simpleObjects;
/**
* Test Listing of All Simple Objects
*/
public static class ListAll extends SimpleObjectsIntegTest { public static class ListAll extends SimpleObjectsIntegTest {
@Test @Test
@ -83,6 +85,10 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest {
} }
} }
/**
* Test Creation of Simple Objects
*/
public static class Create extends SimpleObjectsIntegTest { public static class Create extends SimpleObjectsIntegTest {
@Test @Test

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.objectmother; package com.iluwatar.objectmother;
/**
* Defines all attributes and behaviour related to the King
*/
public class King implements Royalty { public class King implements Royalty {
boolean isDrunk = false; boolean isDrunk = false;
boolean isHappy = false; boolean isHappy = false;

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.objectmother; package com.iluwatar.objectmother;
/**
* Defines all attributes and behaviour related to the Queen
*/
public class Queen implements Royalty { public class Queen implements Royalty {
private boolean isDrunk = false; private boolean isDrunk = false;
private boolean isHappy = false; private boolean isHappy = false;

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.objectmother; package com.iluwatar.objectmother;
/**
* Interface contracting Royalty Behaviour
*/
public interface Royalty { public interface Royalty {
void makeDrunk(); void makeDrunk();

View File

@ -22,6 +22,9 @@
*/ */
package com.iluwatar.objectmother; package com.iluwatar.objectmother;
/**
* Object Mother Pattern generating Royalty Types
*/
public final class RoyaltyObjectMother { public final class RoyaltyObjectMother {
/** /**

View File

@ -33,6 +33,9 @@ import com.iluwatar.objectmother.Queen;
import com.iluwatar.objectmother.Royalty; import com.iluwatar.objectmother.Royalty;
import com.iluwatar.objectmother.RoyaltyObjectMother; import com.iluwatar.objectmother.RoyaltyObjectMother;
/**
* Test Generation of Royalty Types using the object-mother
*/
public class RoyaltyObjectMotherTest { public class RoyaltyObjectMotherTest {
@Test @Test

View File

@ -26,8 +26,8 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
/** /**
*
* Generic object pool * Generic object pool
* @param <T> Type T of Object in the Pool
*/ */
public abstract class ObjectPool<T> { public abstract class ObjectPool<T> {

View File

@ -23,8 +23,10 @@
package com.iluwatar.observer.generic; package com.iluwatar.observer.generic;
/** /**
*
* Observer * 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> { public interface Observer<S extends Observable<S, O, A>, O extends Observer<S, O, A>, A> {

View File

@ -22,18 +22,18 @@
*/ */
package com.iluwatar.observer; package com.iluwatar.observer;
import static org.junit.Assert.assertEquals;
import com.iluwatar.observer.utils.InMemoryAppender; import com.iluwatar.observer.utils.InMemoryAppender;
import java.util.function.Supplier;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.util.function.Supplier;
import static org.junit.Assert.assertEquals;
/** /**
* Date: 12/27/15 - 11:44 AM * Date: 12/27/15 - 11:44 AM
* * Weather Observer Tests
* @param <O> Type of WeatherObserver
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class WeatherObserverTest<O extends WeatherObserver> { public abstract class WeatherObserverTest<O extends WeatherObserver> {

View File

@ -22,19 +22,19 @@
*/ */
package com.iluwatar.observer.generic; package com.iluwatar.observer.generic;
import static org.junit.Assert.assertEquals;
import com.iluwatar.observer.WeatherType; import com.iluwatar.observer.WeatherType;
import com.iluwatar.observer.utils.InMemoryAppender; import com.iluwatar.observer.utils.InMemoryAppender;
import java.util.function.Supplier;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.util.function.Supplier;
import static org.junit.Assert.assertEquals;
/** /**
* Date: 12/27/15 - 11:44 AM * Date: 12/27/15 - 11:44 AM
* * Test for Observers
* @param <O> Type of Observer
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class ObserverTest<O extends Observer> { public abstract class ObserverTest<O extends Observer> {

View File

@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -23,15 +23,17 @@
package com.iluwatar.pageobject; package com.iluwatar.pageobject;
import static org.junit.Assert.assertTrue;
import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.AlbumPage; import com.iluwatar.pageobject.pages.AlbumPage;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertTrue; /**
* Test Album Selection and Album Listing
*/
public class AlbumListPageTest { public class AlbumListPageTest {
private AlbumListPage albumListPage = new AlbumListPage(new WebClient()); private AlbumListPage albumListPage = new AlbumListPage(new WebClient());

View File

@ -22,14 +22,17 @@
*/ */
package com.iluwatar.pageobject; package com.iluwatar.pageobject;
import static org.junit.Assert.assertTrue;
import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.AlbumPage; import com.iluwatar.pageobject.pages.AlbumPage;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertTrue; /**
* Test Album Page Operations
*/
public class AlbumPageTest { public class AlbumPageTest {
private AlbumPage albumPage = new AlbumPage(new WebClient()); private AlbumPage albumPage = new AlbumPage(new WebClient());

View File

@ -22,14 +22,17 @@
*/ */
package com.iluwatar.pageobject; package com.iluwatar.pageobject;
import static org.junit.Assert.assertTrue;
import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebClient;
import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.AlbumListPage;
import com.iluwatar.pageobject.pages.LoginPage; import com.iluwatar.pageobject.pages.LoginPage;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertTrue; /**
* Test Login Page Object
*/
public class LoginPageTest { public class LoginPageTest {
private LoginPage loginPage = new LoginPage(new WebClient()); private LoginPage loginPage = new LoginPage(new WebClient());

View File

@ -63,6 +63,9 @@ public interface Message {
}; };
/**
* Enumeration of Type of Headers
*/
public enum Headers { public enum Headers {
DATE, SENDER DATE, SENDER
} }

View File

@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -39,6 +39,9 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
/**
* Utility to perform various operations
*/
public class Utility { public class Utility {
private static final Logger LOGGER = LoggerFactory.getLogger(Utility.class); private static final Logger LOGGER = LoggerFactory.getLogger(Utility.class);

View File

@ -30,6 +30,9 @@ import java.util.Map;
*/ */
public class Character implements Prototype { public class Character implements Prototype {
/**
* Enumeration of Character types
*/
public enum Type { public enum Type {
WARRIOR, MAGE, ROGUE WARRIOR, MAGE, ROGUE
} }

View File

@ -22,21 +22,20 @@
*/ */
package com.iluwatar.prototype; 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.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame; 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 * Date: 12/28/15 - 8:45 PM
* * @param <P> Prototype
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)

View File

@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* InMemory Log Appender Util.
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -34,6 +34,9 @@ import org.springframework.data.jpa.domain.Specification;
*/ */
public class PersonSpecifications { public class PersonSpecifications {
/**
* Specifications stating the Between (From - To) Age Specification
*/
public static class AgeBetweenSpec implements Specification<Person> { public static class AgeBetweenSpec implements Specification<Person> {
private int from; private int from;

View File

@ -22,19 +22,18 @@
*/ */
package com.iluwatar.resource.acquisition.is.initialization; package com.iluwatar.resource.acquisition.is.initialization;
import static org.junit.Assert.assertTrue;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.AppenderBase;
import java.util.LinkedList;
import java.util.List;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; 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 * Date: 12/28/15 - 9:31 PM
* *
@ -64,6 +63,9 @@ public class ClosableTest {
assertTrue(appender.logContains("Sliding door closes.")); assertTrue(appender.logContains("Sliding door closes."));
} }
/**
* Logging Appender Implementation
*/
public class InMemoryAppender extends AppenderBase<ILoggingEvent> { public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>(); private List<ILoggingEvent> log = new LinkedList<>();

View File

@ -27,6 +27,9 @@ package com.iluwatar.semaphore;
*/ */
public class Fruit { public class Fruit {
/**
* Enumeration of Fruit Types
*/
public static enum FruitType { public static enum FruitType {
ORANGE, APPLE, LEMON ORANGE, APPLE, LEMON
} }

View File

@ -25,6 +25,9 @@ package com.iluwatar.semaphore;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
/**
* Application Test Entrypoint
*/
public class AppTest{ public class AppTest{
@Test @Test
public void test() throws IOException { public void test() throws IOException {

View File

@ -22,23 +22,23 @@
*/ */
package com.iluwatar.servicelayer.common; 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.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; 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 * 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 * @author Jeroen Meulemeester
*/ */
public abstract class BaseDaoTest<E extends BaseEntity, D extends DaoBaseImpl<E>> { public abstract class BaseDaoTest<E extends BaseEntity, D extends DaoBaseImpl<E>> {

View File

@ -22,7 +22,8 @@
*/ */
package com.iluwatar.singleton; 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.ArrayList;
import java.util.List; import java.util.List;
@ -31,9 +32,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
/** /**
* This class provides several test case that test singleton construction. * 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. * the same when called in the DIFFERENT thread.
* *
* Date: 12/29/15 - 19:25 PM * Date: 12/29/15 - 19:25 PM
* * @param <S> Supplier method generating singletons
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
* @author Richard Jones * @author Richard Jones
*/ */

View File

@ -22,23 +22,22 @@
*/ */
package com.iluwatar.templatemethod; 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.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase; import ch.qos.logback.core.AppenderBase;
import java.util.LinkedList;
import java.util.List;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; 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 * Date: 12/30/15 - 18:12 PM
* * @param <M> Type of StealingMethod
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class StealingMethodTest<M extends StealingMethod> { public abstract class StealingMethodTest<M extends StealingMethod> {

View File

@ -22,7 +22,8 @@
*/ */
package com.iluwatar.threadpool; 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.ArrayList;
import java.util.List; import java.util.List;
@ -34,13 +35,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/** /**
* Date: 12/30/15 - 18:22 PM * Date: 12/30/15 - 18:22 PM
* * Test for Tasks using a Thread Pool
* @param <T> Type of Task
* @author Jeroen Meulemeester * @author Jeroen Meulemeester
*/ */
public abstract class TaskTest<T extends Task> { public abstract class TaskTest<T extends Task> {

Some files were not shown because too many files have changed in this diff Show More