modules/base/src/test/java/test/com/sun/javafx/event/EventDispatchTreeTest.java

Print this page
rev 9235 : 8134760: Refactor Javafx base module tests for clear separation of tests
Reviewed-by:


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.event;
  27 


  28 import javafx.event.EventDispatcher;
  29 import org.junit.Assert;
  30 import org.junit.Test;
  31 
  32 public final class EventDispatchTreeTest {
  33     @Test
  34     public void resetTest() {
  35         EventDispatchTree eventDispatchTree = new EventDispatchTreeImpl();
  36 
  37         final EventDispatcher dispatcherA = new LabeledEventDispatcher("A");
  38         final EventDispatcher dispatcherB = new LabeledEventDispatcher("B");
  39         final EventDispatcher dispatcherC = new LabeledEventDispatcher("C");
  40 
  41         eventDispatchTree = eventDispatchTree.append(dispatcherA);
  42         ((EventDispatchTreeImpl) eventDispatchTree).reset();
  43 
  44         eventDispatchTree = eventDispatchTree.append(dispatcherB)
  45                                              .append(dispatcherC);
  46 
  47         Assert.assertEquals("(B->(C))", eventDispatchTree.toString());




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package test.com.sun.javafx.event;
  27 
  28 import com.sun.javafx.event.EventDispatchTree;
  29 import com.sun.javafx.event.EventDispatchTreeImpl;
  30 import javafx.event.EventDispatcher;
  31 import org.junit.Assert;
  32 import org.junit.Test;
  33 
  34 public final class EventDispatchTreeTest {
  35     @Test
  36     public void resetTest() {
  37         EventDispatchTree eventDispatchTree = new EventDispatchTreeImpl();
  38 
  39         final EventDispatcher dispatcherA = new LabeledEventDispatcher("A");
  40         final EventDispatcher dispatcherB = new LabeledEventDispatcher("B");
  41         final EventDispatcher dispatcherC = new LabeledEventDispatcher("C");
  42 
  43         eventDispatchTree = eventDispatchTree.append(dispatcherA);
  44         ((EventDispatchTreeImpl) eventDispatchTree).reset();
  45 
  46         eventDispatchTree = eventDispatchTree.append(dispatcherB)
  47                                              .append(dispatcherC);
  48 
  49         Assert.assertEquals("(B->(C))", eventDispatchTree.toString());