Example usage for java.lang Object Object

List of usage examples for java.lang Object Object

Introduction

In this page you can find the example usage for java.lang Object Object.

Prototype

@HotSpotIntrinsicCandidate
public Object() 

Source Link

Document

Constructs a new object.

Usage

From source file:jenkins.plugins.consolelinenumber.ConsoleLineNumberNoteTest.java

@SuppressWarnings("unchecked")
private String annotate(String text, ConsoleNote... notes) {
    Object context = new Object();
    MarkupText markupText = new MarkupText(text);
    for (ConsoleNote note : notes) {
        note.annotate(context, markupText, 0);
    }/*from   w  w  w.j  ava  2  s  .  c  o  m*/
    return markupText.toString(true);
}

From source file:org.springmodules.util.ObjectsTests.java

/**
 * Verifies that the method//from  w  w  w . ja  v a2s . c  om
 * <code>{@link Objects#identityToString(Object)}</code> returns a
 * <code>StringBuffer</code> containing the class name of the given object,
 * the "@" symbol and the hex string form of the object's identity hash code.
 */
public void testIdentityToString() {
    Object obj = new Object();

    StringBuffer expected = new StringBuffer(obj.getClass().getName());
    expected.append("@" + ObjectUtils.getIdentityHexString(obj));

    StringBuffer actual = Objects.identityToString(obj);

    assertEquals(expected.toString(), actual.toString());
}

From source file:com.hp.autonomy.hod.client.config.ResponseParserTest.java

@Test
public void testParseResponseToClassWithARefreshedToken() throws IOException {
    final ResponseAndBody responseAndBody = createTestRefreshResponse();

    final JavaType objectType = typeFactory.uncheckedSimpleType(Object.class);
    when(objectMapper.constructType(eq(Object.class))).thenReturn(objectType);

    final Object expectedReturnValue = new Object();

    @SuppressWarnings("unchecked")
    final AuthenticationToken<EntityType.Application, TokenType.Simple> newToken = mock(
            AuthenticationToken.class);
    final AuthenticationToken.Json newTokenJson = mock(AuthenticationToken.Json.class);
    when(newTokenJson.buildToken(EntityType.Application.INSTANCE, TokenType.Simple.INSTANCE))
            .thenReturn(newToken);//from  w  ww  .  j a  va 2 s .co  m

    when(objectMapper.readValue(isA(String.class), eq(AuthenticationToken.Json.class)))
            .thenReturn(newTokenJson);
    when(objectMapper.readValue(eq(responseAndBody.body), eq(objectType))).thenReturn(expectedReturnValue);

    final TokenProxy<EntityType.Application, TokenType.Simple> tokenProxy = new TokenProxy<>(
            EntityType.Application.INSTANCE, TokenType.Simple.INSTANCE);

    final Object returnValue = responseParser.parseResponse(tokenProxy, Object.class, responseAndBody.response);

    verify(tokenRepository).update(tokenProxy, newToken);
    assertThat(returnValue, is(expectedReturnValue));
}

From source file:com.boothj5.minions.MinionsRunner.java

void run() throws MinionsException {
    try {/*from w ww  .  j a va 2  s .c om*/
        LOG.debug("Starting MinionsRunner");
        ConnectionConfiguration connectionConfiguration;
        if (StringUtils.isNotBlank(config.getServer())) {
            connectionConfiguration = new ConnectionConfiguration(config.getServer(), config.getPort(),
                    config.getService());
        } else {
            connectionConfiguration = new ConnectionConfiguration(config.getService(), config.getPort());
        }

        XMPPConnection conn = new XMPPConnection(connectionConfiguration);
        conn.connect();
        conn.login(config.getUser(), config.getPassword(), config.getResource());
        LOG.debug(format("Logged in: %s@%s", config.getUser(), config.getService()));

        MultiUserChat muc = new MultiUserChat(conn, config.getRoom());
        if (StringUtils.isBlank(config.getRoomPassword())) {
            muc.join(config.getRoomNick());
        } else {
            muc.join(config.getRoomNick(), config.getRoomPassword());
        }

        LOG.debug(format("Joined: %s as %s", config.getRoom(), config.getRoomNick()));

        MinionStore minions = new MinionStore(config.getPluginsDir(), config.getRefreshSeconds(), muc);

        MinionsListener listener = new MinionsListener(minions, config.getPrefix(), muc, config.getRoomNick());

        muc.addMessageListener(listener);

        Object lock = new Object();
        synchronized (lock) {
            while (true) {
                lock.wait();
            }
        }
    } catch (Throwable t) {
        throw new MinionsException(t);
    }
}

From source file:de.r2soft.empires.framework.test.ObjectTreeTest.java

@Test
public void testRange() {
    Object obj = new Object();
    tree.insert(new Vector2D(100, 100), obj);
    Object[] objT = tree.range(new Vector2D(90, 90), new Vector2D(110, 110));
    Assert.assertEquals(1, objT.length);
    Assert.assertEquals(obj, objT[0]);/*ww w. j  a  va2 s  .c  o m*/
}

From source file:TransitionDetectorMain.java

public TransitionDetector(boolean initialValue) {
    value = initialValue;// ww w . j  a v  a 2 s. c o m
    valueLock = new Object();
    falseToTrueLock = new Object();
    trueToFalseLock = new Object();
}

From source file:de.codecentric.boot.admin.discovery.ApplicationDiscoveryListenerTest.java

@Test
public void test_ignore() {
    when(discovery.getServices()).thenReturn(Collections.singletonList("service"));
    when(discovery.getInstances("service")).thenReturn(Collections
            .singletonList((ServiceInstance) new DefaultServiceInstance("service", "localhost", 80, false)));

    listener.setIgnoredServices(Collections.singleton("service"));
    listener.onInstanceRegistered(new InstanceRegisteredEvent<>(new Object(), null));

    assertEquals(0, registry.getApplications().size());
}

From source file:com.job.portal.dao.UserDetailsDAO.java

public JSONObject checkCredentials(String email, String pwd) {
    JSONObject obj = null;/*from   w ww.  j  a v  a 2 s.  c  om*/
    System.out.println(email + "\t" + pwd);
    try {
        String salt = getSalt(email);
        byte hashArr[] = HashingUtils.getHash(pwd, HashingUtils.base64ToByte(salt));
        String hash = HashingUtils.byteToBase64(hashArr);
        String query = "select userId,dob,email,gender,joined,name," + " phone,pwdHash,role,salt"
                + " from user_details where email=? and pwdHash=?";
        Object arr[] = new Object[2];
        arr[0] = email;
        arr[1] = hash;
        obj = fetchOne(query, arr);
    } catch (Exception e) {
        LogOut.log.error("In " + new Object() {
        }.getClass().getEnclosingClass().getName() + "." + new Object() {
        }.getClass().getEnclosingMethod().getName() + " " + e);
    } finally {
        return obj;
    }
}

From source file:com.github.pjungermann.config.specification.constraint.inetAddress.InetAddressConstraintTest.java

/**
 * @return expectation configs which are not valid for this {@link Constraint}.
 *//*from www . ja va2  s  .com*/
@Override
protected Object[] getInvalidExpectationConfigs() {
    return new Object[] { null, new Object(), 123 };
}

From source file:edu.illinois.imunit.examples.apache.collections.TestBlockingBuffer.java

/**
 * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#add(Object)}.
 *//*from   w  w  w . ja  v a2 s. c om*/
@Test
@Schedule("[beforeGet]@main->beforeAdd@addThread")
public void testGetWithAdd() {
    Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer());
    Object obj = new Object();
    new NonDelayedAdd(blockingBuffer, obj, "addThread").start();

    // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
    fireEvent("beforeGet");
    assertSame(obj, blockingBuffer.get());
    fireEvent("afterGet");
}