List of usage examples for junit.framework Assert assertNotNull
static public void assertNotNull(Object object)
From source file:ejportal.webapp.action.SigelActionTest.java
/** * Test remove.// w w w. j a va2 s. c o m * * @throws Exception * the exception */ public void testRemove() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setDelete(""); final Sigel sigel = new Sigel(); sigel.setSigelId(2L); // action.setSigel(sigel); this.action.setSigelId(2L); Assert.assertEquals("success", this.action.delete()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:de.akquinet.gomobile.androlog.test.PostReporterTest.java
public void testPostWithLongLog() { Log.init(getContext());//w w w .j av a 2 s.co m String message = "This is a INFO test"; String tag = "my.log.info"; Log.d(tag, message); Log.i(tag, message); Log.w(tag, message); for (int i = 0; i < 200; i++) { Log.w("" + i); } List<String> list = Log.getReportedEntries(); Assert.assertNotNull(list); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(25, list.size()); Log.report(); Log.report("this is a user message", null); Exception error = new MalformedChallengeException("error message", new NumberFormatException()); Log.report(null, error); }
From source file:ejportal.webapp.action.PaketActionTest.java
/** * Test remove./* w ww . java 2 s. c o m*/ * * @throws Exception * the exception */ public void testRemove() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setDelete(""); final Paket paket = new Paket(); paket.setPaketId(2L); // action.setPaket(paket); this.action.setPaketId(2L); Assert.assertEquals("success", this.action.delete()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.OrderControllerTest.java
@Test public void shouldGetDrugOrderAsDefault() throws Exception { Object o = controller.retrieve(DRUG_ORDER_UUID, request); Assert.assertEquals(DRUG_ORDER_UUID, PropertyUtils.getProperty(o, "uuid")); Assert.assertNotNull(PropertyUtils.getProperty(o, "display")); Assert.assertNotNull(PropertyUtils.getProperty(o, "patient")); Assert.assertNotNull(PropertyUtils.getProperty(o, "concept")); }
From source file:com.nomsic.randb.RandbTest.java
@Test public void testGetNextCell_end() throws RandbException, FileNotFoundException, IOException { String name = "TEST"; manager.setAutogenerate(true);//from w ww . j av a 2 s . co m int autogenerateNum = 10; manager.setAutogenerateNum(autogenerateNum); manager.createBlockGroup(name, 2, Arrays.asList(new Integer[] { 2, 4 }), Arrays.asList(new String[] { "A", "B" })); BlockGroup bg = manager.getBlockGroup(name); Cell cell = null; do { cell = bg.getNextUnused(); if (cell != null) bg.markAsUsed(cell); } while (cell != null); int initialSize = bg.getBlocks().size(); cell = manager.getNextCell(name); Assert.assertNotNull(cell); int sizeAfter = manager.getBlockGroup(name).getBlocks().size(); Assert.assertEquals(initialSize + autogenerateNum, sizeAfter); }
From source file:com.vmware.identity.sts.auth.impl.BETAuthenticatorTest.java
@Test public void testAuthCompleted() { final RequestSecurityTokenType rst = newValidRst(); final byte[] initRawLeg = Base64.decodeBase64(rst.getBinaryExchange().getValue()); com.vmware.identity.sts.idm.Authenticator idmAuth = EasyMock .createMock(com.vmware.identity.sts.idm.Authenticator.class); final PrincipalId principalId = new PrincipalId("user", "acme.com"); final GSSResult gssResult = new GSSResult(rst.getContext(), principalId); EasyMock.expect(idmAuth.authenticate(EasyMock.eq(rst.getContext()), EasyMock.aryEq(initRawLeg))) .andReturn(gssResult);/*from www . ja va 2 s .c o m*/ EasyMock.replay(idmAuth); final Authenticator authenticator = new BETAuthenticator(idmAuth); final Result result = authenticator.authenticate(newReq(rst)); Assert.assertNotNull(result); Assert.assertTrue(result.completed()); Assert.assertEquals(principalId, result.getPrincipalId()); Assert.assertEquals(AuthnMethod.KERBEROS, result.getAuthnMethod()); EasyMock.verify(idmAuth); }
From source file:org.openmrs.module.emrapi.account.AccountComponentTest.java
@Test public void shouldSavePersonAndUserAndProvider() { Role fullPrivileges = userService.getRole("Privilege Level: Full"); Role archives = userService.getRole("Application Role: Archives"); Role registration = userService.getRole("Application Role: Registration"); ProviderRole nurse = providerManagementService.getProviderRole(1001); Person person = new Person(); AccountDomainWrapper account = accountService.getAccountByPerson(person); account.setGivenName("Mark"); account.setFamilyName("Jones"); account.setGender("M"); account.setUserEnabled(true);//from w w w .j a v a 2 s. c o m account.setUsername("mjones"); account.setPassword("Mjones123"); account.setDefaultLocale(new Locale("fr")); account.setPrivilegeLevel(fullPrivileges); Set<Role> capabilities = new HashSet<Role>(); capabilities.add(registration); capabilities.add(archives); account.setCapabilities(capabilities); account.setProviderRole(nurse); account.save(); Integer personId = account.getPerson().getPersonId(); Assert.assertNotNull(personId); Integer userId = account.getUser().getUserId(); Assert.assertNotNull(userId); 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()); User expectedUser = userService.getUser(userId); Assert.assertFalse(expectedUser.isRetired()); Assert.assertEquals("mjones", expectedUser.getUsername()); Assert.assertEquals(person, expectedUser.getPerson()); Assert.assertEquals("fr", expectedUser.getUserProperty(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCALE).toString()); Assert.assertTrue(expectedUser.hasRole(fullPrivileges.toString())); Assert.assertTrue(expectedUser.hasRole(archives.toString())); Assert.assertTrue(expectedUser.hasRole(registration.toString())); // note that we don't expose the provider object outside of the account domain wrapper; saves confusion between the // two Provider object types List<Provider> providers = providerManagementService.getProvidersByPerson(expectedPerson, false); Assert.assertEquals(1, providers.size()); Assert.assertEquals(nurse, providers.get(0).getProviderRole()); }
From source file:org.apache.tuscany.sca.binding.atom.MediaCollectionTestCase.java
@Test public void testPrelim() throws Exception { Assert.assertNotNull(scaProviderNode); Assert.assertNotNull(client); }
From source file:com.couchbase.lite.DocumentTest.java
public void testDeleteDocument() throws CouchbaseLiteException { Document document = database.createDocument(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("foo", "foo"); properties.put("bar", Boolean.FALSE); document.putProperties(properties);//from w w w .j a v a2 s. c om Assert.assertNotNull(document.getCurrentRevision()); String docId = document.getId(); document.delete(); Assert.assertTrue(document.isDeleted()); Document fetchedDoc = database.getExistingDocument(docId); Assert.assertNull(fetchedDoc); // query all docs and make sure we don't see that document //database.getAllDocs(new QueryOptions()); Query queryAllDocs = database.createAllDocumentsQuery(); QueryEnumerator queryEnumerator = queryAllDocs.run(); for (Iterator<QueryRow> it = queryEnumerator; it.hasNext();) { QueryRow row = it.next(); Assert.assertFalse(row.getDocument().getId().equals(docId)); } }
From source file:org.sakaiproject.crudplus.dao.test.CrudPlusDaoImplTest.java
/** * TODO - Remove this sample unit test//w ww .j a v a 2s . co m * Test method for {@link org.sakaiproject.crudplus.dao.impl.GenericHibernateDao#findById(java.lang.Class, java.io.Serializable)}. */ public void testFindById() { Long id = item.getId(); Assert.assertNotNull(id); CrudPlusItem item1 = (CrudPlusItem) dao.findById(CrudPlusItem.class, id); Assert.assertNotNull(item1); Assert.assertEquals(item, item1); }