Package junit4.tutorial_1_server

Source Code of junit4.tutorial_1_server.Example4InjectionControllerTest

package junit4.tutorial_1_server;

import com.google.guiceberry.controllable.InjectionController;
import com.google.guiceberry.junit4.GuiceBerryRule;
import com.google.inject.Inject;

import org.junit.Rule;
import org.junit.Test;

import tutorial_1_server.prod.Pet;
import tutorial_1_server.prod.Featured;
import tutorial_1_server.testing.PetStoreEnv4InjectionController;
import tutorial_1_server.testing.WelcomeTestPage;

public class Example4InjectionControllerTest {

  @Rule
  public GuiceBerryRule guiceBerry =
    new GuiceBerryRule(PetStoreEnv4InjectionController.class);
 
  @Inject
  WelcomeTestPage welcomeTestPage;
 
  @Inject
  @Featured
  private InjectionController<Pet> featuredPetInjectionController;

  @Test
  public void testWhenDogIsFeatured() {
    Pet expected = Pet.DOG;
    featuredPetInjectionController.setOverride(expected);
    welcomeTestPage
        .goTo()
        .assertFeaturedPetIs(expected);
  }

  @Test
  public void testWhenCatIsFeatured() {
    Pet expected = Pet.CAT;
    featuredPetInjectionController.setOverride(expected);
    welcomeTestPage
        .goTo()
        .assertFeaturedPetIs(expected);
  }
}
TOP

Related Classes of junit4.tutorial_1_server.Example4InjectionControllerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.