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:com.github.jinahya.codec.commons.RareStringEncoderProxyTest.java

@Test
public void testAsEncoder() throws EncoderException {

    final Encoder encoder = (Encoder) RareStringEncoderProxy.newInstance();

    try {/*from w  ww .  ja  v a  2  s . c  o m*/
        encoder.encode(null);
        Assert.fail("passed: <Object>encode(null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    try {
        encoder.encode(new Object());
        Assert.fail("passed: encode(new Object())");
    } catch (final EncoderException en) {
        // expected;
    }

    final Object expected = "";
    final Object actual = encoder.encode(expected);
    Assert.assertEquals(actual, expected);
}

From source file:core.sample.pool.PoolWorker.java

public void run() {
    try {/*w ww . j ava2s.com*/
        //         log.debug("**** Running Tester Thread = " + id);
        WorkerThread rt1 = (WorkerThread) pool.borrowObject();

        Object synObj = new Object();
        Object[] params = new Object[] { "Hello", new Integer(id) };
        Class[] parmTypes = new Class[] { String.class, int.class };

        rt1.execute("com.findonnet.services.pooling.test.SampleWork", "executeTask", params, parmTypes, synObj);
        //         rt1.execute("com.findonnet.services.pooling.test.SampleWork",
        // "executeTask", null, null, synObj);
        synchronized (synObj) {
            synObj.wait();
        }

        pool.returnObject(rt1);
        //         log.debug("*** Finished Thread " + id);
    } catch (Exception e) {
        log.error("", e);
    }
}

From source file:com.github.jinahya.codec.commons.RareStringDecoderProxyTest.java

@Test
public void testAsDecoder() throws DecoderException {

    final Decoder decoder = (Decoder) RareStringDecoderProxy.newInstance();

    try {/*  w w  w  . j  av  a 2s.  c o m*/
        decoder.decode((Object) null);
        Assert.fail("passed: decode((Object) null)");
    } catch (final NullPointerException npe) {
        // expected
    }

    try {
        decoder.decode(new Object());
        Assert.fail("passed: decode(new Object())");
    } catch (final DecoderException de) {
        // expected;
    }

    final Object expected = "";
    final Object actual = decoder.decode(expected);
    Assert.assertEquals(actual, expected);
}

From source file:org.apache.mina.springrpc.MinaServerHandlerTest.java

@Test(expected = IllegalArgumentException.class)
public final void messageReceivedInvalidType() throws Exception {
    ReturnAddressAwareRemoteInvocationHandler remoteInvocationInvoker = EasyMock
            .createMock(ReturnAddressAwareRemoteInvocationHandler.class);
    MinaServerHandler handler = new MinaServerHandler(remoteInvocationInvoker);
    Object invalidType = new Object();
    handler.messageReceived(null, invalidType);
}

From source file:io.mapzone.controller.LoginAppDesign.java

/**
 * //from   w  w  w  .j a  v a2s. co m
 *
 * @param handler The handler that consumes a pair of username/passwd.
 * @return The of the newly registered handler.
 */
public static String registerHandler(Consumer<User> handler) {
    String handlerId = String.valueOf(new Object().hashCode());
    if (handlers.put(handlerId, handler) != null) {
        throw new IllegalStateException("handlerId already registered: " + handlerId);
    }
    return handlerId;
}

From source file:gov.nih.nci.cabig.ctms.web.tabs.TabbedFlowFormControllerTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    controller = new TestController();
    flow = new Flow<Object>("test");
    flow.addTab(new Tab<Object>("One", "one", "one"));
    flow.addTab(new Tab<Object>("Two", "two", "two"));
    flow.addTab(new Tab<Object>("Three", "three", "three"));
    controller.setFlow(flow);/* w  w  w.  j a  v  a 2  s. com*/

    command = new Object();
}

From source file:com.job.portal.servlets.ProfileServlet.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    JSONObject obj = null;//from  ww w . j  a  va2  s . co m
    JSONArray arr = null;
    try {
        String param = request.getParameter("param");
        HttpSession sess = request.getSession(false);
        UserDetails ud = (UserDetails) sess.getAttribute("user");
        if (param != null) {
            if (param.equalsIgnoreCase("getProfile")) {

            } else if (param.equalsIgnoreCase("getPostedJobs")) {
            }
        }
    } catch (Exception e) {
        LogOut.log.error("In " + new Object() {
        }.getClass().getEnclosingClass().getName() + "." + new Object() {
        }.getClass().getEnclosingMethod().getName() + " " + e);
    } finally {
        out.close();
    }
}

From source file:uk.co.unclealex.process.spring.PackageCheckingPostProcessorTest.java

/**
 * Test nomissing packages.
 */
@Test
public void testNomissingPackages() {
    test(new Object(), true);
}

From source file:alluxio.client.rest.TestCaseOptionsTest.java

/**
 * Tests getting and setting fields./*from  w w w. j a  v a 2 s .  co  m*/
 */
@Test
public void fields() {
    Random random = new Random();
    Object body = new Object();
    byte[] bytes = new byte[5];
    random.nextBytes(bytes);
    InputStream inputStream = new ByteArrayInputStream(bytes);
    boolean prettyPrint = random.nextBoolean();
    TestCaseOptions options = TestCaseOptions.defaults();
    String md5 = RandomStringUtils.random(64);

    options.setBody(body);
    options.setInputStream(inputStream);
    options.setPrettyPrint(prettyPrint);
    options.setMD5(md5);

    Assert.assertEquals(body, options.getBody());
    Assert.assertEquals(inputStream, options.getInputStream());
    Assert.assertEquals(prettyPrint, options.isPrettyPrint());
    Assert.assertEquals(md5, options.getMD5());
}

From source file:com.nokia.dempsy.router.TestRouterInstantiation.java

@Test
public void testGetMessages() throws Throwable {
    ApplicationDefinition app = new ApplicationDefinition("test");
    Router router = new Router(app);

    List<Object> messages = new ArrayList<Object>();
    Object first = new Object();
    router.getMessages(first, messages);
    Assert.assertEquals(1, messages.size());
    Assert.assertSame(first, messages.get(0));
}