当前位置: 首页>>代码示例>>Java>>正文


Java Before类代码示例

本文整理汇总了Java中org.junit.Before的典型用法代码示例。如果您正苦于以下问题:Java Before类的具体用法?Java Before怎么用?Java Before使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Before类属于org.junit包,在下文中一共展示了Before类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();

    final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
    idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());


    final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
            Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
                    new PrincipalBearingCredentialsAuthenticationHandler(),
                    new PrincipalBearingPrincipalResolver()));
    final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
            new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
            idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
            mock(ServicesManager.class), mock(LogoutManager.class));
    this.action.setCentralAuthenticationService(centralAuthenticationService);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests.java

示例2: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws InterruptedException {
	super.setUp();
	HashMap testMap = new <String, Object> HashMap();
	testMap.put("testComponet", "AG_Border");
	testMap.put("testChildCaseInit", "AG_Border_Text_Border_Left_Color");
	testMap.put("step1",new HashMap(){
		{
			put("click", "#FF0000");
			put("screenshot", "AG_Border_Text_Border_Left_Color_01_#FF0000");
		}
	});
	testMap.put("step2",new HashMap(){
		{
			put("click", "#00FFFF");
			put("screenshot", "AG_Border_Text_Border_Left_Color_02_#00FFFF");
		}
	});
	super.setTestMap(testMap);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:AG_Border_Text_Border_Left_Color.java

示例3: init

import org.junit.Before; //导入依赖的package包/类
@Before
public void init() throws Exception {
    MobileEngageExperimental.enableFeature(MobileEngageFeature.IN_APP_MESSAGING);

    application = (Application) InstrumentationRegistry.getTargetContext().getApplicationContext();
    coreCompletionHandler = mock(MobileEngageCoreCompletionHandler.class);
    mobileEngageInternal = mock(MobileEngageInternal.class);
    inboxInternal = mock(InboxInternal.class);
    baseConfig = new MobileEngageConfig.Builder()
            .application(application)
            .credentials(appID, appSecret)
            .disableDefaultChannel()
            .build();
    MobileEngage.inboxInstance = inboxInternal;
    MobileEngage.instance = mobileEngageInternal;
    MobileEngage.completionHandler = coreCompletionHandler;

    ConnectivityWatchdogTestUtils.resetCurrentActivityWatchdog();
}
 
开发者ID:emartech,项目名称:android-mobile-engage-sdk,代码行数:20,代码来源:MobileEngageTest.java

示例4: setup

import org.junit.Before; //导入依赖的package包/类
@Before
public void setup() {
    // set up mock objects
    request = mock(Request.class);
    session = mock(Session.class);
    when(request.session()).thenReturn(session);
    engine = mock(TemplateEngine.class);

    // set up friendly objects
    playerLobby = new PlayerLobby();
    playerLobby.addPlayer(new Player("inuse"));
    gameLobby = new GameLobby();
    gameCenter = new GameCenter(playerLobby, gameLobby);

    CuT = new PostSigninRoute(engine, gameCenter);
}
 
开发者ID:ChresSSB,项目名称:Webcheckers,代码行数:17,代码来源:PostSigninRouteTest.java

示例5: setup

import org.junit.Before; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  TEST_UTIL.startMiniZKCluster();
  Configuration conf = TEST_UTIL.getConfiguration();
  zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
      "split-log-worker-tests", null);
  ds = new DummyServer(zkw, conf);
  ZKUtil.deleteChildrenRecursively(zkw, zkw.baseZNode);
  ZKUtil.createAndFailSilent(zkw, zkw.baseZNode);
  assertThat(ZKUtil.checkExists(zkw, zkw.baseZNode), not (is(-1)));
  LOG.debug(zkw.baseZNode + " created");
  ZKUtil.createAndFailSilent(zkw, zkw.splitLogZNode);
  assertThat(ZKUtil.checkExists(zkw, zkw.splitLogZNode), not (is(-1)));

  LOG.debug(zkw.splitLogZNode + " created");
  ZKUtil.createAndFailSilent(zkw, zkw.rsZNode);
  assertThat(ZKUtil.checkExists(zkw, zkw.rsZNode), not (is(-1)));

  SplitLogCounters.resetCounters();
  executorService = new ExecutorService("TestSplitLogWorker");
  executorService.startExecutorService(ExecutorType.RS_LOG_REPLAY_OPS, 10);
  this.mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ?
      RecoveryMode.LOG_REPLAY : RecoveryMode.LOG_SPLITTING);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:TestSplitLogWorker.java

示例6: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws InterruptedException {
	super.setUp();
	HashMap testMap = new <String, Object> HashMap();
	testMap.put("testComponet", "AG_Border");
	testMap.put("testChildCaseInit", "AG_Border_Image_Border_Right_Color");
	testMap.put("step1",new HashMap(){
		{
			put("click", "#FF0000");
			put("screenshot", "AG_Border_Image_Border_Right_Color_01_#FF0000");
		}
	});
	testMap.put("step2",new HashMap(){
		{
			put("click", "#00FFFF");
			put("screenshot", "AG_Border_Image_Border_Right_Color_02_#00FFFF");
		}
	});
	super.setTestMap(testMap);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:AG_Border_Image_Border_Right_Color.java

示例7: setupCoordinator

import org.junit.Before; //导入依赖的package包/类
@Before
public void setupCoordinator() {
    this.mockTime = new MockTime();
    this.mockClient = new MockClient(mockTime);

    Metadata metadata = new Metadata(100L, 60 * 60 * 1000L, true);
    this.consumerClient = new ConsumerNetworkClient(mockClient, metadata, mockTime,
            RETRY_BACKOFF_MS, REQUEST_TIMEOUT_MS);
    Metrics metrics = new Metrics();

    Cluster cluster = TestUtils.singletonCluster("topic", 1);
    metadata.update(cluster, Collections.<String>emptySet(), mockTime.milliseconds());
    this.node = cluster.nodes().get(0);
    mockClient.setNode(node);

    this.coordinatorNode = new Node(Integer.MAX_VALUE - node.id(), node.host(), node.port());
    this.coordinator = new DummyCoordinator(consumerClient, metrics, mockTime);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:19,代码来源:AbstractCoordinatorTest.java

示例8: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	points = new Point[6][2];
	graph = new DijkstraGraph();
	for(int y = 0; y < 2; y++) {
		for(int x = 0; x < 6; x++) {
			points[x][y] = new Point(1.0);
			graph.addPoint(points[x][y]);
			if(y != 0) {
				graph.addConnection(points[x][y], points[x][y - 1]);
			}
			if(x != 0) {
				graph.addConnection(points[x][y], points[x - 1][y]);
			}
		}
	}
	points[0][1].entryCost = 2.0;
	points[2][0].entryCost = 4.0;
	points[4][1].entryCost = 4.0;
}
 
开发者ID:Akhier,项目名称:DijkstraAlgorithm-Java,代码行数:21,代码来源:testDijkstraGraph.java

示例9: before

import org.junit.Before; //导入依赖的package包/类
@Before
public void before() {
    stubProviderOne = new StateStoreProviderStub(false);
    stubProviderTwo = new StateStoreProviderStub(false);
    underlyingWindowStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE);
    stubProviderOne.addStore(storeName, underlyingWindowStore);

    otherUnderlyingStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE);
    stubProviderOne.addStore("other-window-store", otherUnderlyingStore);


    windowStore = new CompositeReadOnlyWindowStore<>(
        new WrappingStoreProvider(Arrays.<StateStoreProvider>asList(stubProviderOne, stubProviderTwo)),
            QueryableStoreTypes.<String, String>windowStore(),
            storeName);
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:17,代码来源:CompositeReadOnlyWindowStoreTest.java

示例10: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws InterruptedException {
	super.setUp();
	HashMap testMap = new <String, Object> HashMap();
	testMap.put("testComponet", "AG_Input");
	testMap.put("testChildCaseInit", "AG_Input_Input_Font_Style");
	testMap.put("step1",new HashMap(){
		{
			put("click", "normal");
			put("screenshot", "AG_Input_Input_Font_Style_01_normal");
		}
	});
	testMap.put("step2",new HashMap(){
		{
			put("click", "italic");
			put("screenshot", "AG_Input_Input_Font_Style_02_italic");
		}
	});
	super.setTestMap(testMap);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:AG_Input_Input_Font_Style.java

示例11: setUp

import org.junit.Before; //导入依赖的package包/类
@Before public void setUp() {
  Retrofit retrofit = new Retrofit.Builder()
      .baseUrl(server.url("/"))
      .addConverterFactory(new StringConverterFactory())
      .addCallAdapterFactory(ScalaCallAdapterFactory.create())
      .build();
  service = retrofit.create(Service.class);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:FutureTest.java

示例12: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() {
    groupAnswersControllerModel = new GroupAnswersControllerModel(identifiableAnswersByTypeFinder, model);
    groupController1 = mock(GroupAnswersController.class);
    groupController2 = mock(GroupAnswersController.class);

    groupControllers = Lists.newArrayList(groupController1, groupController2);

    groupAnswersControllerModel.setGroupChoicesControllers(groupControllers);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:11,代码来源:GroupAnswersControllerModelTest.java

示例13: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    idpEntityId = "idpEntityId";
    rpEntityId = "rpEntityId";
    translatedAuthnRequest = SamlResponseWithAuthnRequestInformationDtoBuilder.aSamlResponseWithAuthnRequestInformationDto().withIssuer(rpEntityId).build();
    rpSamlRequest = SamlAuthnRequestContainerDtoBuilder.aSamlAuthnRequestContainerDto().build();
    idpSsoUri = UriBuilder.fromPath("idpSsoUri").build();

    configStub.reset();
    configStub.setupStubForEnabledIdps(asList(idpEntityId));
    configStub.setUpStubForLevelsOfAssurance(rpEntityId);
    configStub.setUpStubForMatchingServiceEntityId(rpEntityId, msEntityId);
    configStub.setupStubForEidasEnabledForTransaction(rpEntityId, false);
    eventSinkStub.setupStubForLogging();
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:16,代码来源:SessionResourceIntegrationTest.java

示例14: setup

import org.junit.Before; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    emptyLogsFolder();

    configServiceMock = setupConfigurationMockForLogging();
    listener = new LoggerInitListener() {
        @Override
        ConfigurationService getConfigurationService() {
            return configServiceMock;
        }
    };

    logger = LoggerFactory.getLogger(this.getClass());
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:15,代码来源:LoggerInitListenerTest.java

示例15: setUp

import org.junit.Before; //导入依赖的package包/类
@Before
public void setUp() {
	operations.dropCollection(Image.class);

	operations.insert(new Image("1",
		"learning-spring-boot-cover.jpg"));
	operations.insert(new Image("2",
		"learning-spring-boot-2nd-edition-cover.jpg"));
	operations.insert(new Image("3",
		"bazinga.png"));
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-Boot-2.0-Second-Edition,代码行数:12,代码来源:ImageServiceTests.java


注:本文中的org.junit.Before类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。