當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。