List of usage examples for java.lang Object Object
@HotSpotIntrinsicCandidate
public Object()
From source file:edu.illinois.enforcemop.examples.apache.collections.TestBlockingBuffer.java
/** * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#add(Object)}. *///from w ww . jav a2s .c o m @Test // @Schedules({ // @Schedule(name = "GetWithAdd", sequence = "[beforeGet:afterGet]@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 . /* @Event("beforeGet")*/ assertSame("GetWithAdd", obj, blockingBuffer.get()); /* @Event("afterGet")*/ }
From source file:it.anyplace.sync.discovery.DiscoveryHandler.java
public DiscoveryHandler(ConfigurationService configuration, DeviceAddressRepository deviceAddressRepository) { logger.info("init"); this.configuration = configuration; this.deviceAddressRepository = deviceAddressRepository; localDiscorveryHandler = new LocalDiscorveryHandler(configuration); globalDiscoveryHandler = new GlobalDiscoveryHandler(configuration); localDiscorveryHandler.getEventBus().register(new Object() { @Subscribe/*from w ww. ja v a 2 s. c om*/ public void handleMessageReceivedEvent(LocalDiscorveryHandler.MessageReceivedEvent event) { logger.info("received device address list from local discovery"); processDeviceAddressBg(event.getDeviceAddresses()); } }); }
From source file:com.uimirror.auth.LoginStepDef.java
@Then("^I call the login service$") public void i_call_the_login_service() throws Throwable { when(someBean.test()).thenReturn("Helooooooooo done"); String res = new RestTemplate().postForObject("http://localhost:8080/uim/auth/api/auth/login", new Object(), String.class); System.out.println(res);//w ww . java 2s . co m throw new PendingException(); }
From source file:com.google.gwt.emultest.java.util.ArrayDequeTest.java
public void testAddFirst() { Object o1 = new Object(); Object o2 = new Object(); Object o3 = new Object(); ArrayDeque<Object> deque = new ArrayDeque<>(); deque.addFirst(o1);/*from ww w. j av a2s . c o m*/ checkDequeSizeAndContent(deque, o1); deque.addFirst(o2); checkDequeSizeAndContent(deque, o2, o1); deque.addFirst(o3); checkDequeSizeAndContent(deque, o3, o2, o1); try { deque.addFirst(null); fail(); } catch (NullPointerException expected) { } }
From source file:shiver.me.timbers.waiting.SpringPropertyGetterTest.java
@Test public void Can_get_a_default_spring_property() { final String key = someString(); final Environment environment = mock(Environment.class); final Object expected = new Object(); // Given/*from w w w.jav a2s . c o m*/ given(context.getEnvironment()).willReturn(environment); given(environment.getProperty(key, expected.toString())).willReturn(expected.toString()); // When final String actual = getter.get(key, expected); // Then assertThat(actual, equalTo(expected.toString())); }
From source file:com.adaptris.util.TestURLString.java
public void testUrlByFile() throws Exception { Object marker = new Object(); File trackedFile = TempFileUtils.createTrackedFile(marker); URLString url = new URLString(trackedFile); assertEquals("file", url.getProtocol()); assertEquals(trackedFile.getCanonicalPath(), new File(url.getFile()).getCanonicalPath()); }
From source file:com.nokia.dempsy.router.TestRouterInstantiation.java
@Test public void testGetMessagesNester() throws Throwable { ApplicationDefinition app = new ApplicationDefinition("test"); Router router = new Router(app); List<Object> messages = new ArrayList<Object>(); List<Object> parent = new ArrayList<Object>(); List<Object> nested = new ArrayList<Object>(); Object first = new Object(); nested.add(first);/*from w ww .jav a2 s . co m*/ parent.add(nested); router.getMessages(parent, messages); Assert.assertEquals(1, messages.size()); Assert.assertSame(first, messages.get(0)); }
From source file:com.adaptris.security.TestConfiguredUrl.java
public void testEquality() throws Exception { assertNotSame(url, new Object()); assertEquals(url, copy);//from w w w. j a v a 2 s . c o m assertEquals(url.hashCode(), copy.hashCode()); assertEquals(0, new ConfiguredUrl().hashCode()); assertNotNull(url.toString()); }
From source file:org.jasig.cas.web.support.ThrottledSubmissionByIpAddressHandlerInterceptorAdapterTests.java
public void testFailuresThenSuccess() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); final ModelAndView modelAndView = new ModelAndView("casLoginView"); request.setMethod("POST"); request.setRemoteAddr("111.111.111.111"); for (int i = 0; i < CONST_FAILURE_THRESHHOLD + 1; i++) { this.adapter.postHandle(request, new MockHttpServletResponse(), new Object(), modelAndView); }//from ww w .j ava 2 s . c om assertFalse(this.adapter.preHandle(request, new MockHttpServletResponse(), new Object())); for (int i = 0; i < CONST_FAILURE_THRESHHOLD; i++) { this.adapter.decrementCounts(); } assertTrue(this.adapter.preHandle(request, new MockHttpServletResponse(), new Object())); }
From source file:org.springmodules.validation.validator.CompoundValidatorTests.java
public void testValidate_WhenAllValidatorsSupport() throws Exception { Object object = new Object(); BindException errors = new BindException(object, "name"); validatorControl1.expectAndReturn(validator1.supports(object.getClass()), true); validator1.validate(object, errors); validatorControl2.expectAndReturn(validator2.supports(object.getClass()), true); validator2.validate(object, errors); validatorControl1.replay();/*from w w w . jav a 2 s.c o m*/ validatorControl2.replay(); validator.validate(object, errors); validatorControl1.verify(); validatorControl2.verify(); }