List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:com.connectsdk.service.sessions.WebOSWebAppSessionTest.java
@Test public void testPrevious() throws JSONException { ResponseListener<Object> listener = Mockito.mock(ResponseListener.class); session.previous(listener);/*w ww .j a v a2 s . c o m*/ Robolectric.runUiThreadTasksIncludingDelayedTasks(); ArgumentCaptor<JSONObject> argPacket = ArgumentCaptor.forClass(JSONObject.class); ArgumentCaptor<JSONObject> argPayload = ArgumentCaptor.forClass(JSONObject.class); Mockito.verify(socket).sendMessage(argPacket.capture(), argPayload.capture()); Mockito.verify(listener).onSuccess(null); JSONObject packet = argPacket.getValue(); JSONObject payload = argPayload.getValue(); Assert.assertNull(payload); Assert.assertTrue(packet.has("payload")); Assert.assertEquals("playPrevious", packet.getJSONObject("payload").getJSONObject("mediaCommand").getString("type")); Assert.assertEquals("connectsdk.mediaCommand", packet.getJSONObject("payload").getString("contentType")); }
From source file:org.openmrs.module.webservices.rest19ext.web.v1_0.controller.LocationAttributeControllerTest.java
@Test public void shouldGetALocationAttribute() throws Exception { Object result = controller.retrieve(Rest19ExtTestConstants.LOCATION_UUID, Rest19ExtTestConstants.LOCATION_ATTRIBUTE_UUID, request); String rfc822Timezone = new SimpleDateFormat("Z").format(new Date()); Assert.assertNotNull(result);/*w w w . j av a 2 s . c o m*/ Assert.assertEquals(Rest19ExtTestConstants.LOCATION_ATTRIBUTE_UUID, PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals("2011-04-25T00:00:00.000" + rfc822Timezone, PropertyUtils.getProperty(result, "value")); Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo")); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.OrderControllerTest.java
@Test public void shouldGetOrderAsRef() throws Exception { request.setParameter(RestConstants.REQUEST_PROPERTY_FOR_REPRESENTATION, Representation.REF.getRepresentation()); Object o = controller.retrieve(ORDER_UUID, request); Assert.assertEquals(ORDER_UUID, PropertyUtils.getProperty(o, "uuid")); Assert.assertNotNull(PropertyUtils.getProperty(o, "display")); Assert.assertNull(PropertyUtils.getProperty(o, "concept")); Util.log("order as ref", o); }
From source file:org.openmrs.module.webservices.rest19ext.web.v1_0.controller.VisitAttributeControllerTest.java
@Test public void shouldGetAVisitAttribute() throws Exception { Object result = controller.retrieve(Rest19ExtTestConstants.VISIT_UUID, Rest19ExtTestConstants.VISIT_ATTRIBUTE_UUID, request); String rfc822Timezone = new SimpleDateFormat("Z").format(new Date()); Assert.assertNotNull(result);//from w w w. j a va2 s . c om Assert.assertEquals(Rest19ExtTestConstants.VISIT_ATTRIBUTE_UUID, PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals("2011-04-25T00:00:00.000" + rfc822Timezone, PropertyUtils.getProperty(result, "value")); Assert.assertNull(PropertyUtils.getProperty(result, "auditInfo")); }
From source file:org.apache.wink.test.mock.MockHttpServletRequestWrapperTestCase.java
@Test public void testQuery() throws Exception { MockHttpServletRequest req = MockRequestConstructor.constructMockRequest("GET", "/test", "application/json", (String) null, null); req.setQueryString("x=1&y=2&z=%20"); String x = req.getParameter("x"); String y = req.getParameter("y"); String z = req.getParameter("z"); String a = req.getParameter("a"); Assert.assertEquals("1", x); Assert.assertEquals("2", y); Assert.assertEquals(" ", z); Assert.assertNull(a); Assert.assertEquals(3, req.getParameterMap().size()); }
From source file:org.openxdata.server.service.impl.UserServiceTest.java
@Test public void deleteUser_shouldDeleteGivenUser() throws Exception { final String userName = "User Name"; List<User> users = userService.getUsers(); Assert.assertEquals("There are 5 users", 5, users.size()); Assert.assertNull(getUser(userName, users)); User user = new User(userName); user.setCreator(users.get(0));//from w w w . j a v a 2 s. c o m user.setDateCreated(new Date()); userService.saveUser(user); users = userService.getUsers(); Assert.assertEquals("Added 1 user so now there are 6", 6, users.size()); user = getUser(userName, users); Assert.assertNotNull(user); userService.deleteUser(user); users = userService.getUsers(); Assert.assertEquals("Deleted the user so now there are 5", 5, users.size()); Assert.assertNull(getUser(userName, users)); }
From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceGroupConfigBeanDefinitionParserTest.java
@Test public void test1() { RemoteServiceGroupConfig config;//from w w w . j ava 2 s. com config = appContext.getBean("serviceGroup101", RemoteServiceGroupConfig.class); Assert.assertNull(config.getResponseCompressionEnabled()); Assert.assertNull(config.getRpcTokenProtectionEnabled()); Assert.assertNull(config.getRpcTokenValidatorName()); Assert.assertEquals(0, config.getServiceConfigs().size()); Assert.assertEquals(0, config.getChildGroupConfigs().size()); }
From source file:org.openmrs.module.emrapi.account.AccountComponentTest.java
@Test public void shouldSavePerson() { Person person = new Person(); AccountDomainWrapper account = accountService.getAccountByPerson(person); account.setGivenName("Mark"); account.setFamilyName("Jones"); account.setGender("M"); account.save();// w ww. j av a 2 s. c o m Integer personId = account.getPerson().getPersonId(); Assert.assertNotNull(personId); Context.flushSession(); Context.clearSession(); Person expectedPerson = personService.getPerson(personId); Assert.assertEquals("Mark", expectedPerson.getGivenName()); Assert.assertEquals("Jones", expectedPerson.getFamilyName()); Assert.assertEquals("M", expectedPerson.getGender()); Assert.assertEquals(Context.getAuthenticatedUser(), expectedPerson.getPersonCreator()); Assert.assertNotNull(expectedPerson.getPersonDateCreated()); Assert.assertNull(account.getUser()); }
From source file:org.openxdata.server.service.impl.StudyManagerServiceTest.java
@Test public void deleteStudy_shouldDeleteGivenStudy() throws Exception { final String studyName = "Study Name"; List<StudyDef> studies = studyManagerService.getStudies(); Assert.assertEquals("There are 4 studies", 4, studies.size()); Assert.assertNull(getStudy(studyName, studies)); StudyDef study = new StudyDef(); study.setName(studyName);//w ww . java 2 s .c o m study.setCreator(userService.getUsers().get(0)); study.setDateCreated(new Date()); studyManagerService.saveStudy(study); studies = studyManagerService.getStudies(); Assert.assertEquals("Added 1 study, now there are 5", 5, studies.size()); study = getStudy(studyName, studies); Assert.assertNotNull(study); studyManagerService.deleteStudy(study); studies = studyManagerService.getStudies(); Assert.assertEquals("Deleted the study so there are 4 studies again", 4, studies.size()); Assert.assertNull(getStudy(studyName, studies)); }
From source file:com.abiquo.appliancemanager.ApplianceManagerAsserts.java
public void ovfStatus(final String ovfId, final TemplateStatusEnumType expectedStatus) throws AMClientException { TemplateStateDto prevStatus = stub.getTemplateStatus(idEnterprise, ovfId); Assert.assertEquals(expectedStatus, prevStatus.getStatus()); Assert.assertEquals(ovfId, prevStatus.getOvfId()); if (expectedStatus == TemplateStatusEnumType.ERROR) { Assert.assertNotNull(prevStatus.getErrorCause()); } else {// www. j av a 2 s .c o m Assert.assertNull(prevStatus.getErrorCause()); } }