// Path: action/src/main/java/io/cettia/asity/action/Actions.java
// class Options {
// 
//   private boolean once;
//   private boolean memory;
//   private boolean unique;
// 
//   public Options() {
//   }
// 
//   public Options(Options options) {
//     once = options.once;
//     memory = options.memory;
//     unique = options.unique;
//   }
// 
//   public boolean once() {
//     return once;
//   }
// 
//   /**
//    * Ensures the actions can only be fired once. The default value is
//    * false.
//    */
//   public Options once(boolean once) {
//     this.once = once;
//     return this;
//   }
// 
//   public boolean memory() {
//     return memory;
//   }
// 
//   /**
//    * Keeps track of previous values and will call any action added after
//    * the actions has been fired right away with the latest "memorized"
//    * values. The default value is false.
//    */
//   public Options memory(boolean memory) {
//     this.memory = memory;
//     return this;
//   }
// 
//   public boolean unique() {
//     return unique;
//   }
// 
//   /**
//    * Ensures an action can only be added once. The default value is false.
//    */
//   public Options unique(boolean unique) {
//     this.unique = unique;
//     return this;
//   }
// 
// }


import io.cettia.asity.action.Actions.Options;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.cettia.asity.action;




/**
 * @author Donghwan Kim
 */
public abstract class ActionsTestBase {

  @Test
  public void testAdd() {
    Actions<String> actions = null;
    MemoryAction<String> action = null;

    // default
    actions = createActions();
    action = new MemoryAction<>();
    actions.add(action).add(action).fire("A");
    assertThat(action.memory(), contains("A", "A"));
    actions.add(action);
    assertThat(action.memory(), contains("A", "A"));

    // unique
// Path: action/src/main/java/io/cettia/asity/action/Actions.java
// class Options {
// 
//   private boolean once;
//   private boolean memory;
//   private boolean unique;
// 
//   public Options() {
//   }
// 
//   public Options(Options options) {
//     once = options.once;
//     memory = options.memory;
//     unique = options.unique;
//   }
// 
//   public boolean once() {
//     return once;
//   }
// 
//   /**
//    * Ensures the actions can only be fired once. The default value is
//    * false.
//    */
//   public Options once(boolean once) {
//     this.once = once;
//     return this;
//   }
// 
//   public boolean memory() {
//     return memory;
//   }
// 
//   /**
//    * Keeps track of previous values and will call any action added after
//    * the actions has been fired right away with the latest "memorized"
//    * values. The default value is false.
//    */
//   public Options memory(boolean memory) {
//     this.memory = memory;
//     return this;
//   }
// 
//   public boolean unique() {
//     return unique;
//   }
// 
//   /**
//    * Ensures an action can only be added once. The default value is false.
//    */
//   public Options unique(boolean unique) {
//     this.unique = unique;
//     return this;
//   }
// 
// }


// Path: action/src/test/java/io/cettia/asity/action/ActionsTestBase.java
import io.cettia.asity.action.Actions.Options;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.cettia.asity.action;




/**
 * @author Donghwan Kim
 */
public abstract class ActionsTestBase {

  @Test
  public void testAdd() {
    Actions<String> actions = null;
    MemoryAction<String> action = null;

    // default
    actions = createActions();
    action = new MemoryAction<>();
    actions.add(action).add(action).fire("A");
    assertThat(action.memory(), contains("A", "A"));
    actions.add(action);
    assertThat(action.memory(), contains("A", "A"));

    // unique
    actions = createActions(new Actions.Options().unique(true));