/*
 * Copyright 2009 Google Inc.
 *
 * 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 com.google.common.css.compiler.passes;

import com.google.common.css.compiler.ast.BackDoorNodeMutation;
import com.google.common.css.compiler.ast.CssAtRuleNode.Type;
import com.google.common.css.compiler.ast.CssConditionalBlockNode;
import com.google.common.css.compiler.ast.CssConditionalRuleNode;
import com.google.common.css.compiler.ast.CssLiteralNode;
import com.google.common.css.compiler.ast.MutatingVisitController;
import com.google.common.css.testing.UtilityTestCase;

import org.easymock.EasyMock;
import org.easymock.IMocksControl;

/**
 * Unit tests for {@link HasConditionalNodes}.
 *
 */
public class HasConditionalNodesTest extends UtilityTestCase {
  public void testEnterConditionalBlock() {
    IMocksControl controller = EasyMock.createStrictControl();
    MutatingVisitController visitController = controller.createMock(
        MutatingVisitController.class);
    visitController.stopVisit();
    controller.replay();

    HasConditionalNodes pass
        = new HasConditionalNodes(visitController);

    CssConditionalBlockNode node = new CssConditionalBlockNode();
    CssConditionalRuleNode rule = new CssConditionalRuleNode(Type.IF,
        new CssLiteralNode("condition"));
    BackDoorNodeMutation.addRuleToConditionalBlock(node, rule);

    pass.enterConditionalBlock(node);
    controller.verify();
  }

  public void testRunPassAndHasConditionalNodes() {
    IMocksControl controller = EasyMock.createStrictControl();
    MutatingVisitController visitController = controller.createMock(
        MutatingVisitController.class);

    HasConditionalNodes pass
        = new HasConditionalNodes(visitController);

    visitController.startVisit(pass);
    controller.replay();

    pass.runPass();
    assertFalse(pass.hasConditionalNodes());

    controller.verify();
  }
}

@@ -637,16 +637,73 @@
 asses;%0A%0A
+import static com.google.common.truth.Truth.assertThat;%0A%0A
 import c
@@ -1089,56 +1089,57 @@
 ort 
-com.google.common.css.testing.UtilityTestCase
+org.junit.Test;%0Aimport org.junit.runner.RunWith
 ;%0A
-%0A
 impo
@@ -1149,21 +1149,16 @@
 org.
-easymock.Easy
+mockito.
 Mock
@@ -1174,30 +1174,42 @@
 org.
-easymock.IMocksControl
+mockito.runners.MockitoJUnitRunner
 ;%0A%0A/
@@ -1265,16 +1265,51 @@
 %0A *%0A */%0A
+@RunWith(MockitoJUnitRunner.class)%0A
 public c
@@ -1341,308 +1341,111 @@
 est 
-extends UtilityTestCase %7B%0A  public void testEnterConditionalBlock() %7B%0A    IMocksControl controller = EasyMock.createStrictControl();%0A    MutatingVisitController visitController = controller.createMock(%0A        MutatingVisitController.class);%0A    visitController.stopVisit();%0A    controller.replay();%0A
+%7B%0A  @Mock MutatingVisitController visitController;%0A%0A  @Test%0A  public void testEnterConditionalBlock() %7B
 %0A   
@@ -1810,35 +1810,18 @@
 ;%0A  
-  controller.verify();%0A  %7D%0A
+%7D%0A%0A  @Test
 %0A  p
@@ -1873,181 +1873,8 @@
 ) %7B%0A
-    IMocksControl controller = EasyMock.createStrictControl();%0A    MutatingVisitController visitController = controller.createMock(%0A        MutatingVisitController.class);%0A%0A
     
@@ -1992,33 +1992,8 @@
 ss);
-%0A    controller.replay();
 %0A%0A  
@@ -2024,13 +2024,12 @@
 sert
-False
+That
 (pas
@@ -2056,32 +2056,16 @@
 s())
-;%0A%0A    controller.verify
+.isFalse
 ();%0A

Migrate HasConditionalNodesTest to Junit4 and Mockito