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.redhat.lightblue.metadata.types.IntegerTypeTest.java

@Test(expected = Error.class)
public void testCastOther() {
    Object object = new Object();
    integerType.cast(object);
}

From source file:com.xtructure.xutil.valid.strategy.UTestArgumentValidationStrategy.java

public void processSuccessBehavesAsExpected() {
    Condition predicate = isNotNull();
    Object object = new Object();
    String msg = String.format("%s %s", object, predicate);
    ArgumentValidationStrategy<Object> vs = new ArgumentValidationStrategy<Object>(predicate);
    vs.validate(object);//from  w  w  w  .  java  2  s .  co m
    vs.validate(object, msg);
}

From source file:shiver.me.timbers.waiting.SpringPropertyGetterTest.java

@Test
public void Can_get_a_default_spring_property_when_the_application_context_is_null() {

    // Given// w  ww. j a  v  a  2  s.  c om
    final String key = someString();
    final Object expected = new Object();

    // When
    final String actual = new SpringPropertyGetter().get(key, expected);

    // Then
    assertThat(actual, equalTo(expected.toString()));
}

From source file:com.strategicgains.docussandra.handler.IndexCreatedHandlerTest.java

/**
 * Test of handles method, of class IndexCreatedHandler.
 *///from  w w w. j av a 2s . c o  m
@Test
public void testHandles() {
    System.out.println("handles");
    Class eventClass = IndexCreatedEvent.class;
    IndexCreatedHandler instance = new IndexCreatedHandler(indexRepo, statusRepo, docRepo);
    boolean result = instance.handles(eventClass);
    assertEquals(true, result);
    Object o = new Object();
    result = instance.handles(o.getClass());
    assertEquals(false, result);
}

From source file:com.alibaba.otter.shared.arbitrate.setl.BaseStageTest.java

@BeforeClass
public void init() {
    // ?//from w ww .j  a v a  2  s .c  o m
    // mock ???
    local.setStatus(NodeStatus.START);
    Mockit.setUpMock(ArbitrateConfigUtils.class, new Object() {

        @Mock
        public Channel getChannelByChannelId(Long channelId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            Pipeline pipeline = new Pipeline();
            pipeline.setId(pipelineId);
            pipeline.setSelectNodes(Arrays.asList(local));
            pipeline.setExtractNodes(Arrays.asList(local));
            pipeline.setLoadNodes(Arrays.asList(local));
            channel.setPipelines(Arrays.asList(pipeline));
            return channel;
        }

        @Mock
        public Channel getChannel(Long pipelineId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            Pipeline pipeline = new Pipeline();
            pipeline.setId(pipelineId);
            pipeline.setSelectNodes(Arrays.asList(local));
            pipeline.setExtractNodes(Arrays.asList(local));
            pipeline.setLoadNodes(Arrays.asList(local));
            channel.setPipelines(Arrays.asList(pipeline));
            return channel;
        }

        @Mock
        public Pipeline getPipeline(Long pipelineId) {
            Pipeline pipeline = new Pipeline();
            pipeline.setSelectNodes(Arrays.asList(local));
            pipeline.setExtractNodes(Arrays.asList(local));
            pipeline.setLoadNodes(Arrays.asList(local));
            return pipeline;
        }

        @Mock
        public Pipeline getOppositePipeline(Long pipelineId) {
            return null;// ????
        }

        @Mock
        public Long getCurrentNid() {
            return nid;
        }

        @Mock
        public int getParallelism(Long pipelineId) {
            return 3;// 
        }

    });

    Mockit.setUpMock(ArbitrateCommmunicationClient.class, new Object() {

        @Mock
        public Object callManager(final Event event) {
            // do nothing
            return null;
        }

        @Mock
        public void callManager(final Event event, final Callback callback) {
            // do nothing
        }
    });

    zookeeper = getZookeeper();
    local.setId(nid);
    nodeEvent = new NodeArbitrateEvent();
    channelEvent = new ChannelArbitrateEvent();
    pipelineEvent = new PipelineArbitrateEvent();

    pipelinePath = StagePathUtils.getPipeline(channelId, pipelineId);
    processPath = StagePathUtils.getProcessRoot(channelId, pipelineId);
    channelEvent.init(channelId);
    pipelineEvent.init(channelId, pipelineId);
    channelEvent.start(channelId);

    String path = pipelinePath + "/" + ArbitrateConstants.NODE_MAINSTEM;
    MainStemEventData eventData = new MainStemEventData();
    eventData.setStatus(MainStemEventData.Status.OVERTAKE);
    eventData.setNid(nid);
    byte[] bytes = JsonUtils.marshalToByte(eventData);// ??

    zookeeper.create(path, bytes, CreateMode.EPHEMERAL);
}

From source file:com.google.gwt.emultest.java.util.ArrayDequeTest.java

public void testAddLast() {
    Object o1 = new Object();
    Object o2 = new Object();
    Object o3 = new Object();

    ArrayDeque<Object> deque = new ArrayDeque<>();
    deque.addLast(o1);/* w  ww . ja v  a 2 s.  com*/
    checkDequeSizeAndContent(deque, o1);
    deque.addLast(o2);
    checkDequeSizeAndContent(deque, o1, o2);
    deque.addLast(o3);
    checkDequeSizeAndContent(deque, o1, o2, o3);

    try {
        deque.addLast(null);
        fail();
    } catch (NullPointerException expected) {
    }
}

From source file:com.redhat.lightblue.metadata.types.BooleanTypeTest.java

@Test(expected = Error.class)
public void testCastOther() {
    Object object = new Object();
    booleanType.cast(object);
}

From source file:eric.bottard.tis100.Runner.java

public Runner(int rows, int columns, String specificationFile, File solution) throws IOException {

    Specification specification = new LuaSpecification(specificationFile, rows, columns);

    List<String> nodeSources = loadSolution(solution, specification.getLayout());

    this.rows = rows;
    this.columns = columns;

    verticalChannels = new MessageChannel[columns * (rows + 1) * 2];
    horizontalChannels = new MessageChannel[rows * (columns + 1) * 2];

    // channels[2*x] = ltr / down-to-up
    // channels[2*x + 1] = rtl / up-to-down
    for (int row = 0; row <= rows; row++) {
        for (int column = 0; column < columns; column++) {
            verticalChannels[(row * columns + column) * 2] = (row == 0 || row == rows) ? new NullChannel()
                    : new RendezvousChannel();
            if (row == 0) {
                verticalChannels[(row * columns + column) * 2 + 1] = new QueueChannel(40);
            } else if (row == rows) {
                verticalChannels[(row * columns + column) * 2 + 1] = new PublishSubscribeChannel();
            } else {
                verticalChannels[(row * columns + column) * 2 + 1] = new RendezvousChannel();
            }//from  www . j av a  2 s  . co m
        }
    }

    for (int row = 0; row < rows; row++) {
        for (int column = 0; column <= columns; column++) {
            horizontalChannels[(column * rows + row) * 2] = (column == 0 || column == columns)
                    ? new NullChannel()
                    : new RendezvousChannel();
            horizontalChannels[(column * rows + row) * 2 + 1] = (column == 0 || column == columns)
                    ? new NullChannel()
                    : new RendezvousChannel();
        }
    }

    Thread[] threads = new Thread[rows * columns];
    Object mutex = new Object();

    for (int row = 0; row < rows; row++) {
        for (int column = 0; column < columns; column++) {
            final SpringNode node = NodeFactory.buildNode(nodeSources.get(row * columns + column));
            final NodePrettyPrinter printer = new NodePrettyPrinter(4 + row * 19,
                    SpecificationPrettyPrinter.WIDTH + 10 + column * 37, node);
            Ports ports = new PortsMapping(row, column);
            node.setPorts(ports);
            nodes.add(node);
            threads[row * columns + column] = new Thread() {
                @Override
                public void run() {

                    boolean more;
                    do {
                        synchronized (mutex) {
                            printer.draw(System.out);
                        }
                        try {
                            Thread.sleep(150);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        more = node.tick();
                    } while (more);
                }
            };
        }
    }

    List<Integer>[] actuals = new List[columns];
    SpecificationPrettyPrinter specificationPrettyPrinter = new SpecificationPrettyPrinter(specification, 2, 2,
            actuals);

    for (int i = 0; i < columns; i++) {
        Specification.Stream stream = specification.getInputStreams()[i];
        if (stream != null) {
            for (Integer in : stream.getData()) {
                verticalChannels[1 + 2 * i].send(new GenericMessage<>(in));
            }
        }
        stream = specification.getOutputStreams()[i];
        final List<Integer> actual = actuals[i] = new ArrayList<>();
        if (stream != null) {
            ((SubscribableChannel) verticalChannels[1 + 2 * (i + rows * columns)])
                    .subscribe(new MessageHandler() {
                        @Override
                        public void handleMessage(Message<?> message) throws MessagingException {
                            actual.add((Integer) message.getPayload());
                            synchronized (mutex) {
                                specificationPrettyPrinter.draw(System.out);
                            }
                        }
                    });
        }
    }
    synchronized (mutex) {
        specificationPrettyPrinter.draw(System.out);
    }

    for (int i = 0; i < rows * columns; i++) {
        threads[i].start();
    }

}

From source file:net.officefloor.plugin.json.write.JsonResponseWriterManagedObjectSourceTest.java

/**
 * Validate will provide values.//from  w w  w .  ja v  a2 s  . c  om
 */
public void testValues() throws Exception {
    this.doWriteObjectTest(
            new MockJsonObject("Daniel", new MockJsonSubObject("SUB"), new Object(), "ONE", "two", "Three"),
            "{\"name\":\"Daniel\",\"array\":[\"ONE\",\"two\",\"Three\"],\"subObject\":{\"text\":\"SUB\"},\"empty\":{}}");
}

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

@Test
// @Schedules({/*from  w ww  . j a  v a2s .c o  m*/
//   @Schedule(name = "GetWithAddTimeout", sequence = "[beforeGet:afterGet]@main->beforeAdd@addThread") })
public void testGetWithAddTimeout() {
    Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer(), 500);
    Object obj = new Object();
    new DelayedAdd(blockingBuffer, obj, 100).start();

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