List of usage examples for junit.framework Assert assertFalse
static public void assertFalse(boolean condition)
From source file:io.selendroid.server.internal.SelendroidAssert.java
public static void assertResponseValueHasNoSessionId(JSONObject responseValue) { Assert.assertFalse(responseValue.has("SESSION_ID_KEY")); }
From source file:org.openmrs.module.sdmxhdintegration.SDMXHDMessageValidatorTest.java
@Test @Verifies(value = "should support only message class", method = "supports(Class)") public void supports_shouldSupportOnlyMessageClass() { Assert.assertTrue(validator.supports(SDMXHDMessage.class)); Assert.assertFalse(validator.supports(Object.class)); }
From source file:com.sap.prd.mobile.ios.mios.OTAManagerTest.java
@Test public void testOtaUrlIsNull() throws Exception { OTAManager otaManager = new OTAManager(null, "", "", "", "", "", "", null); Assert.assertFalse(otaManager.generateOtaHTML()); CharArrayWriter charWriter = new CharArrayWriter(); try {// w ww. java2s.c o m otaManager.writeOtaHtml(new PrintWriter(charWriter)); assertTrue(charWriter.size() == 0); } finally { closeQuietly(charWriter); } }
From source file:com.cloudant.sync.util.JSONUtilsTest.java
@Test public void isValidJSON_invalidMap() { Map obj = new HashMap<String, String>(); obj.put(null, "123"); Assert.assertFalse(JSONUtils.isValidJSON(obj)); }
From source file:loaders.LoadQueryTransformerTest.java
@Test public void testReplaceSingleCondition() throws Exception { String query = "select id as id from user where id = ${param1}"; HashMap<String, Object> params = new HashMap<String, Object>(); AbstractDbDataLoader.QueryPack queryPack = prepareQuery(query, new BandData(""), params); System.out.println(queryPack.getQuery()); Assert.assertFalse(queryPack.getQuery().contains("${")); writeParams(queryPack);//w w w . j a v a 2 s . c o m params.put("param1", "param1"); queryPack = prepareQuery(query, new BandData(""), params); System.out.println(queryPack.getQuery()); Assert.assertEquals(1, StringUtils.countMatches(queryPack.getQuery(), "?")); writeParams(queryPack); }
From source file:de.hybris.basecommerce.SimpleSmtpServerUtilsTest.java
@Test public void testStartStop() { SimpleSmtpServer server = null;//from ww w . j a v a 2 s . co m try { server = SimpleSmtpServerUtils.startServer(TEST_START_PORT); Assert.assertFalse(server.isStopped()); Assert.assertTrue(server.getPort() > 0); server.stop(); Assert.assertTrue(server.isStopped()); } finally { if (server != null) { server.stop(); } } }
From source file:com.cloudant.sync.util.JSONUtilsTest.java
@Test public void isValidJSON_invalidJSONString() { Assert.assertFalse(JSONUtils.isValidJSON("haha")); }
From source file:org.tritsch.android.chargefinder.CFService.java
/** * <code>lockup<code> will contact the chargefinder service and will retrieve * a/the list of stations described by the parameters. * * @param pointX - x coordinates to start the search from * @param pointY - y coordinates to start the search from * @param radius - the radius from x, y to include in the search * * @return a/the list of stations that are within the radius *///from w w w .j a v a 2 s . c om public static List<CFStation> lookup(final String pointX, final String pointY, final String radius) { if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "Enter: lookup()"); Assert.assertNotNull(pointX); Assert.assertFalse(pointX.length() == 0); Assert.assertNotNull(pointY); Assert.assertFalse(pointY.length() == 0); Assert.assertNotNull(radius); Assert.assertFalse(radius.length() == 0); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "pointX:" + pointX); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "pointY:" + pointY); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "radius:" + radius); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "create the list we will return ..."); List<CFStation> stations = new ArrayList<CFStation>(); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "create http client ..."); HttpClient httpClient = new DefaultHttpClient(); Assert.assertNotNull(httpClient); String url = "" + BASE_URL + "?point_x=" + pointX + "&point_y=" + pointY + "&radius=" + radius; if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "URL:" + url); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "go and do it ..."); HttpResponse response = null; try { response = httpClient.execute(new HttpGet(url)); Assert.assertNotNull(response); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "process response ..."); JSONArray stationsObject = null; try { HttpEntity entity = response.getEntity(); Assert.assertNotNull(entity); String resultString = getString(entity.getContent()); Assert.assertNotNull(resultString); if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Result:" + resultString); JSONObject resultObject = new JSONObject(resultString); Assert.assertNotNull(resultObject); stationsObject = resultObject.getJSONArray("stations"); Assert.assertNotNull(stationsObject); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "build list of stations ..."); try { for (int i = 0; i < stationsObject.length(); i++) { JSONObject station = stationsObject.getJSONObject(i); Assert.assertNotNull(station); CFStation newStation = new CFStation(); newStation.setName(station.getString("name")); newStation.setX(station.getDouble("st_x")); newStation.setY(station.getDouble("st_y")); Assert.assertTrue(stations.add(newStation)); } } catch (Exception e) { e.printStackTrace(); Assert.fail(); } if (Log.isLoggable(TAG, Log.DEBUG)) Log.d(TAG, "Leave: lookup()"); return stations; }
From source file:com.epam.training.storefront.facade.DefaultCheckoutFacadeIntegrationTest.java
@Test public void testCardTypeConversion() throws CommerceCartModificationException { final Collection<CardTypeData> original = checkoutFacade.getSupportedCardTypes(); final Collection<CardTypeData> creditCards = checkoutFacade.getSupportedCardTypes(); if (creditCardFacade.mappingStrategy(creditCards)) { Assert.assertFalse(CollectionUtils.isEqualCollection(original, creditCards)); } else {/*from w w w . ja v a2 s . c o m*/ Assert.assertTrue(CollectionUtils.isEqualCollection(original, creditCards)); } }
From source file:com.cloudant.sync.util.JSONUtilsTest.java
@Test public void isValidJSON_integerString() { Assert.assertFalse(JSONUtils.isValidJSON("101")); }