本文整理匯總了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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());
}
示例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