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:net.dv8tion.jda.core.utils.JDALogger.java

/**
 * Utility function to enable logging of complex statements more efficiently (lazy).
 *
 * @param  lazyLambda/*from w w w .ja v a 2s  .com*/
 *         The Supplier used when evaluating the expression
 *
 * @return An Object that can be passed to SLF4J's logging methods as lazy parameter
 */
public static Object getLazyString(LazyEvaluation lazyLambda) {
    return new Object() {
        @Override
        public String toString() {
            try {
                return lazyLambda.getString();
            } catch (Exception ex) {
                StringWriter sw = new StringWriter();
                ex.printStackTrace(new PrintWriter(sw));
                return "Error while evaluating lazy String... " + sw.toString();
            }
        }
    };
}

From source file:com.alibaba.otter.node.etl.common.pipe.HttpPipeIntegration.java

@BeforeClass
public void initial() {
    Mockit.setUpMock(JettyEmbedServer.class, new Object() {

        @Mock/*from  w ww. j  a  v  a  2 s  .c om*/
        private Integer getPort() {
            return null;
        }

    });

}

From source file:com.alibaba.citrus.util.internal.apache.lang.HashCodeBuilderTests.java

public void testObject() {
    Object obj = null;//from   w w  w  . ja  v a 2s .c  o m
    assertEquals(17 * 37, new HashCodeBuilder(17, 37).append(obj).toHashCode());
    obj = new Object();
    assertEquals(17 * 37 + obj.hashCode(), new HashCodeBuilder(17, 37).append(obj).toHashCode());
}

From source file:jp.terasoluna.fw.beans.jxpath.BeanPointerFactoryExTest.java

/**
 * testCreateNodePointerQname01() <br>
 * <br>//w w  w. j a va2s  .c  om
 * () <br>
 * A <br>
 * <br>
 * () name:not null<br>
 * () bean:new Object()<br>
 * () locale:Locale("ja")<br>
 * <br>
 * () NodePointer:new BeanPointerEX {<br>
 * locale=?locale<br>
 * name=?name<br>
 * bean=?bean<br>
 * }<br>
 * <br>
 * ??? <br>
 * @throws Exception ?????
 */
@Test
public void testCreateNodePointerQname01() throws Exception {
    // ??
    BeanPointerFactoryEx factory = new BeanPointerFactoryEx();
    QName qName = new QName("name");
    Object bean = new Object();
    Locale locale = new Locale("ja");

    // 
    NodePointer result = factory.createNodePointer(qName, bean, locale);

    // 
    assertSame(BeanPointerEx.class, result.getClass());
    assertSame(locale, result.getLocale());
    assertSame(qName, result.getName());
    assertSame(bean, ReflectionTestUtils.getField(result, "bean"));
}

From source file:com.google.api.server.spi.response.ServletResponseResultWriterTest.java

@SuppressWarnings("unused")
public void testTypeChangesInBeanAsString() throws Exception {
    Object value = new Object() {
        public long getPrimitive() {
            return 200L;
        }/*from  w w  w  . j a v a2 s .c  o m*/

        public Long getNonPrimitive() {
            return 100L;
        }

        public Long getLongNull() {
            return null;
        }

        public String getStringNull() {
            return null;
        }

        public String getStringEmpty() {
            return "";
        }

        public Date getDate() {
            return new Date(DATE_VALUE);
        }

        public Date getDateNull() {
            return null;
        }

        public DateAndTime getDateAndTime() {
            return DateAndTime.parseRfc3339String(DATE_AND_TIME_VALUE_STRING);
        }

        public DateAndTime getDateAndTimeNull() {
            return null;
        }

        public SimpleDate getSimpleDate() {
            return new SimpleDate(2002, 10, 2);
        }

        public SimpleDate getSimpleDateNull() {
            return null;
        }

        public Long[] getEmptyLongArray() {
            return new Long[0];
        }

        public List<Long> getEmptyLongList() {
            return new ArrayList<>();
        }
    };
    ObjectNode output = testTypeChangesAsString(value);
    assertTrue(output.path("longNull").isMissingNode());
    assertTrue(output.path("stringNull").isMissingNode());
    assertEquals("", output.path("stringEmpty").asText());
    assertTrue(output.path("dateNull").isMissingNode());
    assertTrue(output.path("dateAndTimeNull").isMissingNode());
    assertTrue(output.path("simpleDateNull").isMissingNode());
    assertTrue(output.path("emptyLongArray").isMissingNode());
    assertTrue(output.path("emptyLongList").isMissingNode());
}

From source file:com.lonepulse.robozombie.proxy.ProcessorInvocationTest.java

/**
 * <p>Tests {@link Processors#RESPONSE} invocation with an illegal {@link InvocationContext} type.</p>
 *  /*from ww  w  .j  av  a2s  . c o m*/
 * @since 1.3.0
 */
@Test
public final void testResponseArgumentContextType() {

    expectedException.expect(Is.isA(RuntimeException.class));
    Processors.RESPONSE.run(new HttpGet(), new Object());
}

From source file:org.mongojack.internal.util.CalendarDeserializerTest.java

@Test(expected = JsonMappingException.class)
public void testWithoutDateObject() throws IOException {
    when(jsonParser.getCurrentToken()).thenReturn(JsonToken.VALUE_EMBEDDED_OBJECT);
    when(jsonParser.getEmbeddedObject()).thenReturn(new Object());

    deserializedDate = deserializer.deserialize(jsonParser, deserializationContext);
}

From source file:com.moss.veracity.core.service.EndorsementManager.java

public EndorsementManager(PersistenceManager persistence, UpdateTransmitter transmitter) {
    this.persistence = persistence;
    this.transmitter = transmitter;
    this.keyLock = new Object();
}

From source file:edu.xjtu.qxcamerabridge.Qx10ServiceDelegatorImpl.java

/**
 * Test Passed on Qx10//from  w  w w.  j  ava  2  s. co  m
 *
 * @return
 */
@Override
public List<ShootMode> getAvailableShootMode() {
    String service = "camera";
    String serviceName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    JSONObject replyJson = JSONActionWrapper.jsonrpc(service, serviceName, new ArrayList<>());
    JSONArray modeArray = replyJson.getJSONArray("result").getJSONArray(1);
    List<ShootMode> modeList = new ArrayList<>();
    for (int i = 0; i < modeArray.length(); i++) {
        modeList.add(ShootMode.valueOf(modeArray.getString(i)));
    }
    return modeList;
}

From source file:ThreadViewer.java

public ThreadViewerTableModel() {
    rowCount = 0;//from  w w w . j ava  2s . c o m
    cellData = new Object[0][0];

    String[] names = { "Priority", "Alive", "Daemon", "Interrupted", "ThreadGroup", "Thread Name" };
    columnName = names;

    Class[] classes = { Integer.class, Boolean.class, Boolean.class, Boolean.class, String.class,
            String.class };
    columnClass = classes;

    columnCount = columnName.length;

    dataLock = new Object();

    noStopRequested = true;
    Runnable r = new Runnable() {
        public void run() {
            try {
                runWork();
            } catch (Exception x) {
                // in case ANY exception slips through
                x.printStackTrace();
            }
        }
    };

    internalThread = new Thread(r, "ThreadViewer");
    internalThread.setPriority(Thread.MAX_PRIORITY - 2);
    internalThread.setDaemon(true);
    internalThread.start();
}