@BeforeEach public void before() { this.sourceTaskContext = mock(SourceTaskContext.class); this.offsetStorageReader = mock(OffsetStorageReader.class); when(this.sourceTaskContext.offsetStorageReader()).thenReturn(this.offsetStorageReader); this.task = new KinesisSourceTask(); this.task.initialize(this.sourceTaskContext); this.kinesisClient = mock(AmazonKinesis.class); this.task.time = mock(Time.class); this.task.kinesisClientFactory = mock(KinesisClientFactory.class); when(this.task.kinesisClientFactory.create(any())).thenReturn(this.kinesisClient); this.settings = TestData.settings(); this.config = new KinesisSourceConnectorConfig(this.settings); }
@BeforeEach public void setUp() { Injector injector = Guice.createInjector( Modules.override( new DatasetModule(), new CannedDatasetsModule(), new ConfigurationModule()) .with( new MongoOverrideModule(), new AbstractModule() { @Override protected void configure() { bind(CannedDatasetsLoader.class) .toInstance(Mockito.mock(CannedDatasetsLoader.class)); } })); injector.injectMembers(this); when(mongoProvider.provide()).thenReturn(getMongoClient()); }
@BeforeEach public void setUp() throws JMSException { initMocks(this); when(mockEvent.getTarget()).thenReturn(of(rdf.createIRI("trellis:repository/resource"))); when(mockEvent.getAgents()).thenReturn(singleton(Trellis.AdministratorAgent)); when(mockEvent.getCreated()).thenReturn(time); when(mockEvent.getIdentifier()).thenReturn(rdf.createIRI("urn:test")); when(mockEvent.getTypes()).thenReturn(singleton(AS.Update)); when(mockEvent.getTargetTypes()).thenReturn(singleton(LDP.RDFSource)); when(mockEvent.getInbox()).thenReturn(empty()); when(mockConnection.createSession(anyBoolean(), eq(AUTO_ACKNOWLEDGE))).thenReturn(mockSession); when(mockSession.createQueue(eq(queueName))).thenReturn(mockQueue); when(mockSession.createTextMessage(anyString())).thenReturn(mockMessage); when(mockSession.createProducer(any(Queue.class))).thenReturn(mockProducer); doNothing().when(mockProducer).send(any(TextMessage.class)); }
@BeforeEach void setUp() throws Exception { MockitoAnnotations.initMocks(this); input = RelationalInputStub.builder() .relationName("Test") .columnName(COL_A).columnName(COL_B).columnName(COL_C) .row(Row.of("x", "z", null)) .row(Row.of("x", "y", null)) .row(Row.of("y", "x", null)) .build(); given(generator.generateNewCopy()).willReturn(input); configuration = SpiderConfiguration.builder() .tempFileGenerator(new FileGeneratorFake()) .resultReceiver(resultReceiver) .relationalInputGenerator(generator) .tpmmsConfiguration(TPMMSConfiguration.withDefaults()) .build(); }
@BeforeEach void setup() throws Exception { // Look for free port for SUT instantiation int port; try (ServerSocket socket = new ServerSocket(0)) { port = socket.getLocalPort(); } remoteFileService = new RemoteFileService("http://localhost:" + port); // Mock server wireMockServer = new WireMockServer(options().port(port)); wireMockServer.start(); configureFor("localhost", wireMockServer.port()); // Stubbing service stubFor(post(urlEqualTo("/api/v1/paths/" + filename + "/open-file")) .willReturn(aResponse().withStatus(200).withBody(streamId))); stubFor(post(urlEqualTo("/api/v1/streams/" + streamId + "/read")) .willReturn(aResponse().withStatus(200).withBody(contentFile))); stubFor(post(urlEqualTo("/api/v1/streams/" + streamId + "/close")) .willReturn(aResponse().withStatus(200))); }
@BeforeEach void setUp() throws Exception { MockitoAnnotations.initMocks(this); columnNames = asList("a", "b", "c", "d"); columnTypes = asList("str", "int", "int", "str"); generator = TableInputGeneratorStub.builder() .relationName("Test") .columnNames(columnNames) .row(Row.of("1", "1", "1", null)) .row(Row.of("1", "1", "3", null)) .row(Row.of(null, "2", "2", null)) .build(); given(tableInfoFactory.create(anyList(), anyList())).willReturn(tableFixture()); impl = new DeMarchi(tableInfoFactory); }
@BeforeEach void setUp() throws IOException { String source = "package com.example; " + "import org.dataj.Data; " + "import javax.annotation.Nonnull;" + "import javax.annotation.Nullable;" + "@Data class NullableFields { @Nonnull String name; @Nullable Integer age; }"; Compilation compilation = javac() .withProcessors(new AnnotationProcessor()) .compile( JavaFileObjects.forSourceString("NullableFields", source) ); JavaFileObject outputFile = compilation.generatedSourceFile("com.example.NullableFieldsData").get(); actualSource = JavaParser.parse(outputFile.openInputStream()); referenceSource = JavaParser.parseResource("NullableFieldsData.java"); }
@BeforeEach public void setup() { this.kinesisClient = mock(AmazonKinesis.class, withSettings().verboseLogging()); this.connector = new KinesisSourceConnector(); this.connector.kinesisClientFactory = mock(KinesisClientFactory.class); when(this.connector.kinesisClientFactory.create(any())).thenReturn(this.kinesisClient); }
@BeforeEach public void setUp() { initMocks(this); when(mockAccessControlService.getAccessModes(any(IRI.class), any(Session.class))).thenReturn(allModes); when(mockContext.getUriInfo()).thenReturn(mockUriInfo); when(mockUriInfo.getQueryParameters()).thenReturn(mockQueryParams); when(mockQueryParams.getOrDefault(eq("ext"), eq(emptyList()))).thenReturn(emptyList()); when(mockUriInfo.getPath()).thenReturn(REPO1); }
/** * Set up application before each test. * Afterwards, calls the {@link #beforeEach()} method. * * @throws TimeoutException if unable to set up application * @throws UIInitialisationException if ui was not properly initialized * @see FxToolkit#setupApplication(Class, String...) */ @BeforeEach public final void basicBeforeEach() throws TimeoutException, UIInitialisationException { this.primaryStage = FxToolkit.registerPrimaryStage(); this.application = (Hygene) FxToolkit.setupApplication(Hygene.class); this.context = Hygene.getInstance().getContext(); FxToolkit.showStage(); beforeEach(); }
@BeforeEach void setUp() { IniSecurityManagerFactory factory = new IniSecurityManagerFactory("./src/test/resources/shiro-test.ini"); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); subject = SecurityUtils.getSubject(); }
@BeforeEach void setUp() { consoleMessage = new ConsoleMessage("The message"); logEvent = mock(LogEvent.class); message = mock(Message.class); when(logEvent.getMessage()).thenReturn(message); }
@Before @BeforeEach public void setup() { ResourcesBuilder builder = ResourcesBuilder.getInstance(); builder.build(Arrays.asList(new OtherParameterController())); CollectionResources resources = builder.getResources(); assertNotNull(resources); Resource r = resources.getResource("/other/parameter"); endpoints = r.getEndpoints(); assertEquals("POST", endpoints.get(POST).getHttpMethod()); }
@BeforeEach public void beforeEach() { graphStore = new GraphStore(); graphDimensionsCalculator = new GraphDimensionsCalculator(graphStore); graphDimensionsCalculator.setGraph(createGraph()); graphDimensionsCalculator.setCanvasSize(mockCanvas().getWidth(), mockCanvas().getHeight()); }
@BeforeEach void beforeEach() { final GraphDimensionsCalculator graphDimensionsCalculator = mock(GraphDimensionsCalculator.class); final GraphicsContext graphicsContext = mock(GraphicsContext.class); graphAnnotationVisualizer = new GraphAnnotationVisualizer(graphDimensionsCalculator); graphAnnotationVisualizer.setGraphicsContext(graphicsContext); }
@BeforeEach public void setUp() { Injector injector = Guice.createInjector( Modules.override(new DatasetModule(), new ConfigurationModule()) .with(new MongoOverrideModule())); injector.injectMembers(this); when(mongoProvider.provide()).thenReturn(getMongoClient()); }
@BeforeEach void init() { //打开chrome浏览器 System.setProperty("webdriver.chrome.driver", Thread.currentThread().getContextClassLoader() .getResource("autotest/" + "chromedriver.exe").getPath()); ChromeOptions options = new ChromeOptions(); options.addArguments("disable-infobars"); d = new ChromeDriver(options); d.manage().window().maximize(); d.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); }
@BeforeEach public void setUp() { initMocks(this); doCallRealMethod().when(mockBinaryService).calculateDigest(any(), any()); doCallRealMethod().when(mockBinaryService).setContent(any(), any()); when(mockBinaryService.getContent(any())).thenReturn(of(mockInputStream)); when(mockBinaryService.exists(eq(identifier))).thenReturn(true); when(mockBinaryService.digest(any(), any())).thenReturn(of(checksum)); }
@BeforeEach public void setUp() { AsyncUtils.setAsyncRunner(Runnable::run); NetworkTableUtils.shutdown(); inst = NetworkTableInstance.create(); inst.waitForEntryListenerQueue(-1.0); inst.setUpdateRate(0.01); table = inst.getTable(""); }
@BeforeEach void before() throws NoSuchFieldException, IllegalAccessException { ValidationServiceImpl meep = new ValidationServiceImpl(environment); Field rt = meep.getClass().getDeclaredField("restTemplate"); rt.setAccessible(true); rt.set(meep, restTemplate); rt.setAccessible(false); objectUnderTest = spy(meep); Converter.ConversionReport report = mock(Converter.ConversionReport.class); when(report.getEncoded()).thenReturn(qppWrapper); when(converter.getReport()).thenReturn(report); }
@BeforeEach public void initTest() throws Exception { InstrumentingClassLoader cl = new InstrumentingClassLoader("com.foo"); sc = (StringCalls) cl.loadClass(StringCallsImp.class.getName()) .newInstance(); }
@BeforeEach public void setUp() { initMocks(this); when(mockResource.getMementos()).thenReturn(emptyList()); when(mockResource.isMemento()).thenReturn(false); when(mockResource.getExtraLinkRelations()).thenAnswer(inv -> empty()); when(mockRequest.getBaseUrl()).thenReturn(baseUrl); when(mockRequest.getPath()).thenReturn("/"); }
@BeforeEach public void commonSetUp() { settingsBuilder = TrautePluginSettingsBuilder.settingsBuilder(); expectCompilationResult = CompilationResultExpectationBuilder.expectCompilationResult(); expectRunResult = RunResultExpectationBuilder.expectRunResult(); Assumptions.assumeTrue(Boolean.getBoolean(ACTIVATION_PROPERTY)); }
@BeforeEach public void setUp() { initMocks(this); when(mockEvent.getIdentifier()).thenReturn(rdf.createIRI("info:event/12345")); when(mockEvent.getAgents()).thenReturn(singleton(rdf.createIRI("info:user/test"))); when(mockEvent.getTarget()).thenReturn(of(rdf.createIRI("trellis:repository/resource"))); when(mockEvent.getTypes()).thenReturn(singleton(Create)); when(mockEvent.getTargetTypes()).thenReturn(singleton(Container)); when(mockEvent.getInbox()).thenReturn(of(rdf.createIRI("info:ldn/inbox"))); when(mockEvent.getCreated()).thenReturn(time); }
@BeforeEach void setUp() throws Exception { String source = "package com.example; import org.dataj.Data; @Entity @Data class Annotated { int age; }"; Compilation compilation = javac() .withProcessors(new AnnotationProcessor()) .compile( JavaFileObjects.forResource("Entity.java"), JavaFileObjects.forSourceString("Annotated", source) ); JavaFileObject outputFile = compilation.generatedSourceFile("com.example.AnnotatedData").get(); actualSource = JavaParser.parse(outputFile.openInputStream()); referenceSource = JavaParser.parseResource("AnnotatedData.java"); }
@BeforeEach public void setUp() { final IRI other = rdf.createIRI("trellis:repository/other"); graph.clear(); graph.add(rdf.createTriple(subject, ACL.agent, rdf.createIRI("info:agent/foo"))); graph.add(rdf.createTriple(subject, ACL.agent, rdf.createIRI("info:agent/bar"))); graph.add(rdf.createTriple(other, ACL.agent, rdf.createIRI("info:agent/baz"))); graph.add(rdf.createTriple(subject, ACL.agentClass, rdf.createIRI("info:agent/SomeClass"))); graph.add(rdf.createTriple(other, ACL.agentClass, rdf.createIRI("info:agent/SomeOtherClass"))); graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group1"))); graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group2"))); graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group3"))); graph.add(rdf.createTriple(subject, ACL.agentGroup, rdf.createIRI("info:group/group4"))); graph.add(rdf.createTriple(subject, ACL.mode, ACL.Read)); graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:repository/resource2"))); graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:repository/resource3"))); graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:repository/resource4"))); graph.add(rdf.createTriple(subject, ACL.accessTo, rdf.createIRI("trellis:repository/resource4"))); graph.add(rdf.createTriple(other, ACL.accessTo, rdf.createIRI("trellis:repository/resource5"))); graph.add(rdf.createTriple(subject, ACL.accessToClass, PROV.Activity)); graph.add(rdf.createTriple(other, ACL.accessToClass, PROV.Entity)); graph.add(rdf.createTriple(subject, ACL.default_, rdf.createIRI("trellis:repository/container"))); }
@BeforeEach private void initJunit5() { ResourcesBuilder builder = ResourcesBuilder.getInstance(); builder.build(Arrays.asList(new PageableController())); resources = builder.getResources(); }
@BeforeEach public void setUp() { initMocks(this); when(mockSession.getAgent()).thenReturn(Trellis.AnonymousAgent); when(mockSession.getCreated()).thenReturn(created); when(mockSession.getDelegatedBy()).thenReturn(of(Trellis.AdministratorAgent)); }
/** * Set up a default node to be pass to an encoder */ @BeforeEach void createNode() { numeratorDenominatorNode = new Node(TemplateId.ACI_AGGREGATE_COUNT); numeratorDenominatorNode.putValue("aggregateCount", "600"); nodes = new ArrayList<>(); nodes.add(numeratorDenominatorNode); }
@BeforeEach public void setUp() { initMocks(this); when(mockResource.getMementos()).thenReturn(emptyList()); when(mockResource.getInteractionModel()).thenReturn(LDP.RDFSource); when(mockResource.getModified()).thenReturn(time); when(mockResource.getBinary()).thenReturn(empty()); when(mockResource.isMemento()).thenReturn(false); when(mockResource.getExtraLinkRelations()).thenAnswer(inv -> Stream.empty()); when(mockLdpRequest.getRequest()).thenReturn(mockRequest); when(mockLdpRequest.getPath()).thenReturn(""); when(mockLdpRequest.getBaseUrl()).thenReturn(baseUrl); when(mockLdpRequest.getHeaders()).thenReturn(mockHeaders); }
@BeforeEach public void setUp() throws IOException { initMocks(this); when(mockEvent.getTarget()).thenReturn(of(rdf.createIRI("trellis:repository/resource"))); when(mockEvent.getAgents()).thenReturn(singleton(Trellis.AdministratorAgent)); when(mockEvent.getCreated()).thenReturn(time); when(mockEvent.getIdentifier()).thenReturn(rdf.createIRI("urn:test")); when(mockEvent.getTypes()).thenReturn(singleton(AS.Update)); when(mockEvent.getTargetTypes()).thenReturn(singleton(LDP.RDFSource)); when(mockEvent.getInbox()).thenReturn(empty()); doNothing().when(mockChannel).basicPublish(eq(exchangeName), eq(queueName), anyBoolean(), anyBoolean(), any(BasicProperties.class), any(byte[].class)); }
@BeforeEach void setUp() throws Exception { compilation = compile(); JavaFileObject outputFile = compilation.generatedSourceFile("com.example.TestData").get(); actualSource = JavaParser.parse(outputFile.openInputStream()); referenceSource = JavaParser.parseResource("TestData.java"); }
@BeforeEach public void setUpMocks() throws Exception { initMocks(this); when(mockCurator.create()).thenReturn(mockCreateBuilder); when(mockCreateBuilder.orSetData()).thenReturn(mockCreateBuilder2); when(mockCache.getListenable()).thenReturn(mockListenable); }
@BeforeEach void runBeforeEachTest() { doAnswer(invocationOnMock -> { Runnable method = invocationOnMock.getArgument(0); CompletableFuture.runAsync(method); return null; }).when(taskExecutor).execute(any(Runnable.class)); }
@BeforeEach @Override protected void setUp() throws IOException { super.setUp(); when(cache.getCachedFiles()).thenReturn(cachedDevices); when(farmClient.connectToDevices(any(DevicesParams.class))).thenReturn(Flowable.just((Notification.createOnNext("url")))); connectCommand = new ConnectCommand(farmClient, adbRunner, cache, logger); }
@BeforeEach void setUp() { log.info("Test beginning..."); }
@BeforeEach void setUp() { itemEAO = new ItemEAO(); emf = Persistence.createEntityManagerFactory("eclipselink"); em = emf.createEntityManager(); }
@BeforeEach public void before() { this.transformation = new CEFTransformation<>(); this.transformation.configure(ImmutableMap.of()); }
@BeforeEach void setUp() {}