Java Code Examples for org.testng.annotations.BeforeMethod

The following are top voted examples for showing how to use org.testng.annotations.BeforeMethod. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: marathonv5   File: RComboBox2Test.java   Source Code and License 7 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(RComboBox2Test.class.getName());
            frame.setName("dialog-1");
            Employee[] items = { new Employee("Phillip"), new Employee("Larry"), new Employee("Lisa"), new Employee("James"),
                    new Employee("Larry") };
            MyComboBoxModel model = new MyComboBoxModel(items);
            JComboBox comboBox = new JComboBox(model);
            comboBox.setName("Employee");
            frame.getContentPane().add(comboBox);
            frame.pack();
            frame.setVisible(true);
        }
    });
}
 
Example 2
Project: shibboleth-idp-oidc-extension   File: EncodeMessageTest.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@BeforeMethod
public void setUp() throws ComponentInitializationException {
    message = new MockMessage();
    message.getProperties().put("foo", "3");
    message.getProperties().put("bar", "1");
    message.getProperties().put("baz", "2");

    // Encoded mock message, keys sorted alphabetically, per
    // MockMessage#toString
    expectedMessage = "bar=1&baz=2&foo=3";

    messageContext = new MessageContext<>();
    messageContext.setMessage(message);

    profileCtx = new ProfileRequestContext();
    profileCtx.setOutboundMessageContext(messageContext);

    encoder = new MockMessageEncoder();
    // Note: we don't init the encoder, b/c that is done by the action after
    // setting the message context
}
 
Example 3
Project: NaukriSite   File: Setup.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
public void siteUp () {

	final String exe = "chromedriver.exe";
	final String path = getClass ().getClassLoader ()
		.getResource (exe)
		.getPath ();
	final String webSite = "http://www.naukri.com";
	final String binaryPath = "C:\\Users\\DELL\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe";
	
	System.setProperty("webdriver.chrome.driver", path);
	ChromeOptions chromeOpt= new ChromeOptions();
	chromeOpt.setBinary(binaryPath);
	
	driver = new ChromeDriver (chromeOpt);
	driver.get(webSite);
	driver.manage ().timeouts ().implicitlyWait (10, TimeUnit.SECONDS);
	driver.manage().window().maximize();
	windowHandling ();
}
 
Example 4
Project: shibboleth-idp-oidc-extension   File: StorageServiceClientInformationManagerTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
public void setupTests() throws Exception {
    storageService = new MemoryStorageService();
    storageService.setId("mockId");
    storageService.initialize();
    
    manager = new StorageServiceClientInformationManager();
    manager.setStorageService(storageService);
    manager.setId("mockId");
    manager.initialize();
    
    resolver = new StorageServiceClientInformationResolver();
    resolver.setStorageService(storageService);
    resolver.setId("mockId");
    resolver.initialize();
    
    clientIdValue = "mockClientId";
}
 
Example 5
Project: pyplyn   File: SensitiveByteArraySerializerTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    // ARRANGE
    serializer = new SensitiveByteArraySerializer();
    deserializer = new SensitiveByteArrayDeserializer();
}
 
Example 6
Project: teamcity-powershell   File: ScriptGeneratorTest.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("ResultOfMethodCallIgnored")
@Override
@BeforeMethod
public void setUp() throws Exception {
  super.setUp();
  m = new Mockery() {{
    setImposteriser(ClassImposteriser.INSTANCE);
  }};
  myTempDir = createTempDir();
  myCheckoutDir = createTempDir();
  myGenerator = new ScriptGenerator();
}
 
Example 7
Project: marathonv5   File: JSpinnerJavaElementTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame("My Dialog");
            frame.setName("dialog-1");
            JSpinner listSpinner = createListSpinner();
            Calendar calendar = Calendar.getInstance();
            JSpinner numberSpinner = createNumberSpinner(calendar);
            JSpinner dateSpinner = createDateSpinner(calendar);

            frame.setLayout(new FlowLayout());
            frame.getContentPane().add(listSpinner);
            frame.getContentPane().add(numberSpinner);
            frame.getContentPane().add(dateSpinner);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    driver = new JavaAgent();
}
 
Example 8
Project: cryptotrader   File: EstimatorImplTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {

    services = new TreeMap<>();
    services.put("id0", mock(Estimator.class));
    services.put("id1", mock(Estimator.class));
    services.put("id2", mock(Estimator.class));
    services.put("id3", mock(Estimator.class));
    services.put("id4", mock(Estimator.class));
    services.put("id5", mock(Estimator.class));
    services.put("id6", mock(Estimator.class));
    services.put("id7", mock(Estimator.class));
    services.forEach((k, v) -> when(v.get()).thenReturn(k));

    module = new TestModule();
    when(module.getMock(ServiceFactory.class).loadMap(Estimator.class)).thenReturn(services);

    context = module.getMock(Context.class);
    request = module.createRequestBuilder().build();

    target = new EstimatorImpl(module.createInjector());

}
 
Example 9
Project: gold   File: ReferencedByTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
private void loadSchemas() {
    SchemaWriteAccess access = buildSchemaWriteAccessCacheTestNamespace();

    Map<String, Object> variableMap = buildVariableMap(REFERENCEDBY_TEST_NAMESPACE);

    GraphQLResult resultVideoSchemaCreation = schemaService.executeQuery(videoSchema, variableMap, access);
    assertTrue(resultVideoSchemaCreation.isSuccessful());

    GraphQLResult resultAudioSchemaCreation = schemaService.executeQuery(audioSchema, variableMap, access);
    assertTrue(resultAudioSchemaCreation.isSuccessful());

    GraphQLResult resultDescriptionBlockSchemaCreation = schemaService.executeQuery(descriptionBlockSchema,
            variableMap, access);
    assertTrue(resultDescriptionBlockSchemaCreation.isSuccessful());

    GraphQLResult resultMediaSchemaCreation = schemaService.executeQuery(mediaSchema, variableMap, access);
    assertTrue(resultMediaSchemaCreation.isSuccessful());

    GraphQLResult resultPlaylistSchemaCreation = schemaService.executeQuery(playlistSchema, variableMap, access);
    assertTrue(resultPlaylistSchemaCreation.isSuccessful());

    GraphQLResult resultAudioListSchemaCreation = schemaService.executeQuery(audioListSchema, variableMap, access);
    assertTrue(resultAudioListSchemaCreation.isSuccessful());
}
 
Example 10
Project: marathonv5   File: JSpinner4Test.java   Source Code and License 6 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JSpinner2Test.class.getSimpleName());
            frame.setName("frame-" + JSpinner2Test.class.getSimpleName());
            frame.getContentPane().add(new SpinnerDemo4(), BorderLayout.CENTER);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });

    driver = new JavaDriver();
    spinner = driver.findElement(By.cssSelector("spinner"));

    spinnerButttonUp = spinner.findElement(By.cssSelector("basic-arrow-button:nth(1)"));
    spinnerButtonDown = spinner.findElement(By.cssSelector("basic-arrow-button:nth(2)"));

}
 
Example 11
Project: gold   File: BaseExternalReferenceTest.java   Source Code and License 6 votes vote down vote up
@BeforeMethod
public void loadExternalData() {
    loadSchema();

    final String IMAGE_ID = "1234";
    final String VIDEO_ID = "5678";

    Map<String, Object> imageMap = new HashMap<>();
    imageMap.put("id", IMAGE_ID);
    imageMap.put("title", "Hitchhikers Guide");
    externalReferenceRepository.loadExternalInstance("Image", IMAGE_ID, imageMap);

    Map<String, Object> videoMap = new HashMap<>();
    videoMap.put("id", VIDEO_ID);
    videoMap.put("title", "Casablanca");
    videoMap.put("caption", "The greatest movie ever.");

    externalReferenceRepository.loadExternalInstance("Video", VIDEO_ID, videoMap);
}
 
Example 12
Project: openjdk-jdk10   File: EntityTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    try {
        factory = XMLInputFactory.newInstance();
    } catch (Exception ex) {
        Assert.fail("Could not create XMLInputFactory");
    }
}
 
Example 13
Project: marathonv5   File: JSplitPaneTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JSplitPaneTest.class.getSimpleName());
            frame.setName("frame-" + JSplitPaneTest.class.getSimpleName());
            frame.getContentPane().add(new SplitPaneDemo().getSplitPane(), BorderLayout.CENTER);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
}
 
Example 14
Project: jtk   File: ArrayMathDoubleTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() {
  a1 = rampdouble(0d,1d,n1);
  a2 = rampdouble(0d,1d,10d,n1,n2);
  a3 = rampdouble(0d,1d,10d,100d,n1,n2,n3);
  b1 = zerodouble(n1);
  b2 = zerodouble(n1,n2);
  b3 = zerodouble(n1,n2,n3);
}
 
Example 15
Project: datarouter   File: CascadeIterableTests.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void beforeMethod(){
	twoLists = new ArrayList<>();
	twoLists.add(new ArrayList<>(Arrays.asList(1, 2, 3)));
	twoLists.add(new ArrayList<>(Arrays.asList(400, 500)));
	counter = new AtomicInteger(0);
}
 
Example 16
Project: java-ilp-plugin   File: MockQueuedLedgerPluginTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setup() {
  MockitoAnnotations.initMocks(this);

  // Enable debug mode...
  ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME))
      .setLevel(Level.DEBUG);

  this.ledgerInfo = ImmutableLedgerInfo.builder()
      .currencyScale(8)
      .currencyUnit(Monetary.getCurrency("USD"))
      .ledgerPrefix(LEDGER_PREFIX)
      .build();
  final SimulatedLedger simulatedLedger = new SimulatedLedger(ledgerInfo);

  // Initialize the ledger plugin under test...
  this.eventBus = new EventBus();
  this.mockLedgerPlugin = new QueuedMockLedgerPlugin(getLedgerPluginConfig(), simulatedLedger,
      eventBus);

  // Wire-up an async event handler...
  final EventBusLedgerPluginEventHandler asyncLedgerPluginEventHandler
      = new EventBusLedgerPluginEventHandler(ledgerPluginEventHandlerMock);
  eventBus.register(asyncLedgerPluginEventHandler);
  mockLedgerPlugin.addLedgerPluginEventHandler(asyncLedgerPluginEventHandler);
  mockLedgerPlugin.connect();

  // Reset the event handler so we don't count the "connect" event, in general
  reset(ledgerPluginEventHandlerMock);
}
 
Example 17
Project: pyplyn   File: MetadataTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {
    // ARRANGE
    Transmutation.Metadata metadata = ImmutableTransmutation.Metadata.builder()
            .tags(singletonMap("data", "point"))
            .build();
    data = ImmutableTransmutation.of(ZonedDateTime.now(ZoneOffset.UTC),
            "test",
            1.0d,
            100.0d,
            metadata);
}
 
Example 18
Project: cryptotrader   File: AgentImplTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {

    module = new TestModule();
    context = null;
    propertyManager = module.getMock(PropertyManager.class);
    service = module.getMock(Agent.class);

    Map<String, Agent> services = singletonMap("s", service);
    when(module.getMock(ServiceFactory.class).loadMap(Agent.class)).thenReturn(services);

    target = new AgentImpl(module.createInjector());

}
 
Example 19
Project: shibboleth-idp-oidc-extension   File: OIDCAuthenticationRequestDecoderTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
protected void setUp() throws Exception {
	httpRequest = new MockHttpServletRequest();
	httpRequest.setMethod("GET");
	decoder = new OIDCAuthenticationRequestDecoder();
	decoder.setHttpServletRequest(httpRequest);
	decoder.initialize();
}
 
Example 20
Project: teamcity-kubernetes-plugin   File: KubeCloudClientTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {
    super.setUp();
    m = new Mockery();
    myApi = m.mock(KubeApiConnector.class);
    myPodTemplateProviders = m.mock(BuildAgentPodTemplateProviders.class);
    myCache = new KubeDataCacheImpl();
}
 
Example 21
Project: Java_Good   File: ContactDeletionTests.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void ensurePreconditions() {
    app.goTo().Home();
    if (app.db().contacts().size() == 0) {
        app.goTo().addNewPage();
        app.contact().create(new ContactData()
                .withFirstname("Contact3").withLastname("LastNameContact3").withMobile("1234567980").withEmail("[email protected]")/*.withGroup("test3")*/, true);
    }
}
 
Example 22
Project: Java_Good   File: AddingContactToGroupTests.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void ensurePreconditionsForContacts() {
    app.goTo().Home();
    if (app.db().contacts().size() == 0) {
        app.goTo().addNewPage();
        app.contact().create(new ContactData()
                .withFirstname("Contact3").withLastname("LastNameContact3").withMobile("1234567980").withEmail("[email protected]")/*.withGroup("test3")*/, true);
    }
}
 
Example 23
Project: gdl2   File: AssignmentStatementTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    interpreter = new Interpreter();
    inputMap = new HashMap<>();
    resultMap = new HashMap<>();
    dataValue = null;
}
 
Example 24
Project: strongbox   File: FileUserConfigTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {
    if (configFile.exists()) {
        configFile.delete();
    }
    fileUserConfig = new FileUserConfig(configFile);
    fileUserConfig.addLocalFilePath(GROUP1_US, new File("uswest1-test-group.sm"));
    fileUserConfig.addLocalFilePath(GROUP1_EU, new File("euwest1-test-group.sm"));
    fileUserConfig.addLocalFilePath(GROUP2_EU, new File("euwest1-test-group2.sm"));
}
 
Example 25
Project: Java_Good   File: GroupModificationTests.java   Source Code and License 5 votes vote down vote up
@BeforeMethod

    public void ensurePreconditions() {
        if (app.db().groups().size() == 0) {
            app.goTo().groupPage();
            app.group().create(new GroupData().withName("test3"));
        }
        // if (app.group().all().size()== 0){
        //}
    }
 
Example 26
Project: oneops   File: DeployerTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
private void resetDeploymentData() throws Exception {
  Connection conn = ds.getConnection();
  try (PreparedStatement stmt = conn.prepareStatement("UPDATE dj_deployment_rfc SET state_id = 10 where deployment_id = ?")) {
    stmt.setLong(1, DPMT_ID);
    stmt.executeUpdate();
  }
  try (PreparedStatement stmt = conn.prepareStatement("UPDATE dj_deployment SET state_id = 100, "
      + "auto_pause_exec_orders = null, current_step = null, flags = 0 where deployment_id = ?")) {
    stmt.setLong(1, DPMT_ID);
    stmt.executeUpdate();
  }
  reset(mockExecutor);
}
 
Example 27
Project: openjdk-jdk10   File: Bug7157608Test.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() throws IOException {
    File file1 = new File(getClass().getResource("Bug7157608.xml").getFile());
    xml1 = file1.getPath().replace("\\", "\\\\");
    File file2 = new File(getClass().getResource("Bug7157608_1.xml").getFile());
    xml2 = file2.getPath();
}
 
Example 28
Project: marathonv5   File: JavaAgentTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame("My Dialog");
            frame.setName("dialog-1");
            JMenuBar menuBar = new JMenuBar();
            menu = new JMenu("File");
            menu.setMnemonic(KeyEvent.VK_F);
            menuBar.add(menu);
            exitItem = new JMenuItem("Exit");
            menu.add(exitItem);
            frame.setJMenuBar(menuBar);
            Box box = new Box(BoxLayout.Y_AXIS);
            textField = new JTextField("");

            box.add(textField);
            button = new JButton("Click Me!!");
            box.add(button);
            new Timer().schedule(new TimerTask() {
                @Override public void run() {
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override public void run() {
                            JButton button1 = new JButton("Click Me Delayed!!");
                            button1.setName("click-me-delayed");
                            frame.getContentPane().add(button1);
                        }
                    });
                }
            }, 1000);
            button.setName("click-me");
            frame.setContentPane(box);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    driver = new JavaAgent();
}
 
Example 29
Project: strongbox   File: IAMPolicyManagerTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void setUp() {
    mockCredentials = mock(AWSCredentialsProvider.class);
    mockClient = mock(AmazonIdentityManagementClient.class);
    ClientConfiguration mockConfig = mock(ClientConfiguration.class);
    IAMPolicyManager policyManager = new IAMPolicyManager(mockClient, mockCredentials, mockConfig);

    // The mockito spy acts like original object but mocks out the getAccount() method. As the getAccount() calls
    // directly rather than via a client that we can pass in we need to mock this out using a spy.
    partiallyMockedPolicyManager = spy(policyManager);
    doReturn(ACCOUNT).when(partiallyMockedPolicyManager).getAccount();

    // Set up KMSEncryptor for testing the policy creation methods. This gets a bit complicated but we need to
    // mock all the AWS dependencies from the KMSManager before using it to create the KMSEncryptor. The getAliasArn
    // needs to be mocked out with a spy to stop the call to getAccount.
    mockKMSClient = mock(AWSKMSClient.class);
    KMSManager kmsManager = new KMSManager(mockKMSClient, mockCredentials, mockConfig, group);
    KMSManager partiallyMockedKMSManager = spy(kmsManager);
    doReturn(KMS_ALIAS_ARN).when(partiallyMockedKMSManager).getAliasArn();
    kmsEncryptor = new KMSEncryptor(partiallyMockedKMSManager, mockCredentials, mockConfig, group, mock(AwsCrypto.class), EncryptionStrength.AES_256);

    // Set up store for testing the policy creation methods. Mock out the getArn method with a spy to stop the
    // call to getAccount().
    mockDynamoDBClient = mock(AmazonDynamoDBClient.class);
    DynamoDB store = new DynamoDB(mockDynamoDBClient, mockCredentials, mockConfig, group, new ReentrantReadWriteLock());
    partiallyMockedStore = spy(store);
    doReturn(DYNAMODB_ARN).when(partiallyMockedStore).getArn();
}
 
Example 30
Project: arez   File: AbstractArezExtrasTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
protected void beforeTest()
  throws Exception
{
  BrainCheckTestUtil.resetConfig( false );
  ArezTestUtil.resetConfig( false );
}
 
Example 31
Project: WebAutomation_AllureParallel   File: WebDriverFactory.java   Source Code and License 5 votes vote down vote up
@Parameters({ "browser" , "url" })
@BeforeMethod
public void beforeMethod(String browser, String url) throws Exception
{		
	InitMethod.Browser=browser;
	InitMethod.WebsiteURL=url;
	System.out.println("Browser: "+browser);
	System.out.println("WebsiteURL: "+url);
	new WebDriverFactory();
	WebDriver driver = WebDriverFactory.createDriver(browser,url);
	setWebDriver(driver);
}
 
Example 32
Project: marathonv5   File: JTabbedPaneJavaElementTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JTableJavaElementTest.class.getSimpleName());
            frame.setName("frame-" + JTableJavaElementTest.class.getSimpleName());
            frame.getContentPane().add(new TabbedPaneDemo(), BorderLayout.CENTER);
            frame.setSize(640, 480);
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
    driver = new JavaAgent();
}
 
Example 33
Project: marathonv5   File: RMenuItemTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            MenuSelectionManager.defaultManager().clearSelectedPath();
            frame = new JFrame(RMenuItemTest.class.getSimpleName());
            frame.setName("frame-" + RMenuItemTest.class.getSimpleName());
            MenuDemo demo = new MenuDemo();
            frame.setJMenuBar(demo.createMenuBar());
            frame.setContentPane(demo.createContentPane());
            frame.pack();
            frame.setVisible(true);
        }
    });
    menus = ComponentUtils.findComponents(JMenu.class, frame);
}
 
Example 34
Project: TestNG-Foundation   File: SkipFromBefore.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void beforeMethod(Method method) {
    if ("testMethod".equals(method.getName())) {
        fromBefore = VALUE;
        beforeResult = Reporter.getCurrentTestResult();
        beforeResult.setAttribute(ATTRIBUTE, fromBefore);
        throw new SkipException("Skip from [before]");
    }
}
 
Example 35
Project: Java_Good   File: ContactModificationTests.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void ensurePreconditions(){
    app.goTo().Home();
    if (app.db().contacts().size() == 0) {
        app.goTo().addNewPage();
        app.contact().create(new ContactData()
                .withFirstname("Contact3").withLastname("LastNameContact3").withMobile("1234567980").withEmail("[email protected]")/*.withGroup("test3")*/, true);
    }
}
 
Example 36
Project: marathonv5   File: JTextAreaTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new TextAreaDemo();
            frame.setName("frame-" + JTextAreaTest.class.getSimpleName());
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
}
 
Example 37
Project: marathonv5   File: RAbstractButtonTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    siw(new Runnable() {
        @Override public void run() {
            frame = new JFrame(RAbstractButtonTest.class.getSimpleName());
            frame.setName("frame-" + RAbstractButtonTest.class.getSimpleName());
            frame.getContentPane().add(new DynamicTreeDemo(), BorderLayout.CENTER);
            frame.pack();
            frame.setVisible(true);
        }
    });
}
 
Example 38
Project: keti   File: ResourceAttributeResolverTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void beforeMethod() {
    MockitoAnnotations.initMocks(this);

    this.testResource = new BaseResource("/test/resource");
    when(this.defaultResourceAttributeReader.getAttributes(eq(this.testResource.getResourceIdentifier())))
            .thenReturn(Collections.emptySet());
}
 
Example 39
Project: marathonv5   File: JCheckBoxTest.java   Source Code and License 5 votes vote down vote up
@BeforeMethod public void showDialog() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame = new JFrame(JCheckBoxTest.class.getSimpleName());
            frame.setName("frame-" + JCheckBoxTest.class.getSimpleName());
            frame.getContentPane().add(new CheckBoxDemo(), BorderLayout.CENTER);
            frame.pack();
            frame.setAlwaysOnTop(true);
            frame.setVisible(true);
        }
    });
}
 
Example 40
Project: deployment-recorder-extension   File: PomReadIT.java   Source Code and License 5 votes vote down vote up
@BeforeMethod
public void beforeMethod() {
    consoleOutputStdErr = new StringBuilder();
    consoleOutputStdOut = new StringBuilder();

    originalStdErr = System.err;
    originalStdOut = System.out;

    PrintStream interceptorStdOut = new InterceptorStdOut(originalStdOut);
    PrintStream interceptorStdErr = new InterceptorStdErr(originalStdErr);

    System.setOut(interceptorStdOut);
    System.setErr(interceptorStdErr);
}