List of usage examples for java.lang AssertionError AssertionError
public AssertionError(double detailMessage)
double
, which is converted to a string as defined in section 15.18.1.1 of The Java™ Language Specification. From source file:eu.musesproject.client.connectionmanager.TLSManager.java
/** * Create SSLFactory object using certificate saved in the device * @return SSLSocketFactory//from w w w . j a va2 s . c o m */ private SSLSocketFactory newSslSocketFactory() { try { InputStream in = new ByteArrayInputStream(MusesUtils.getCertificate().getBytes()); KeyStore trustedStore = null; if (in != null) { trustedStore = convertCerToBKS(in, "muses alias", "muses11".toCharArray()); } SSLSocketFactory sf = new SSLSocketFactory(trustedStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); return sf; } catch (Exception e) { throw new AssertionError(e); } }
From source file:com.baidu.qa.service.test.verify.VerifyResponseImpl.java
public void verifyTestResultByHttpRequest(File file, Config config, VariableGenerator vargen) { try {//from w w w. j a va 2s .c om HttpReqImpl req = new HttpReqImpl(); req.requestHttpByHttpClient(file, config, vargen); } catch (Exception e) { throw new AssertionError("verify test result by http request fail"); } }
From source file:com.gs.collections.impl.jmh.map.GscImmutableMapGetTest.java
@Benchmark public void get() { int localSize = this.size; String[] localElements = this.elements; ImmutableMap<String, String> localGscMap = this.gscMap; for (int i = 0; i < localSize; i++) { if (localGscMap.get(localElements[i]) == null) { throw new AssertionError(i); }/*from ww w . ja v a 2 s .c o m*/ } }
From source file:de.unentscheidbar.csv2.ParserBenchmark.java
@Setup(Level.Trial) public void setup() { int bytesPerCharacter = 2; // UTF-16 int charCount = (kiloBytes * 1000 / bytesPerCharacter); try {//www.jav a 2s.co m csv = dataset.get(charCount).getBytes(StandardCharsets.UTF_16BE); } catch (Exception e) { throw new AssertionError(e); } }
From source file:net.joala.condition.regression.Joala45SpringConfigurationUnresolvablePropertyTest.java
@Test public void scenario_joala45_ignore_unresolvable_for_local_properties() throws Exception { final ClassPathXmlApplicationContext applicationContext; try {// w w w . j a v a2s . c o m applicationContext = new ClassPathXmlApplicationContext( "/META-INF/joala/condition/joala-45-context-2.xml"); } catch (BeansException e) { final String msg = "Joala 45 Regression: Conditions Context should not try to resolve local properties."; LOG.error(msg, e); throw new AssertionError(msg); } final Object myString = applicationContext.getBean("myString"); assertEquals("Local bean should have been correctly filled with properties.", "myString", myString); }
From source file:magrathea.marvin.desktop.user.dao.DerbyDAO.DerbyUserDAO.java
@Override public List<User> findUsersByProperty(UserSearchType searchType, Object value) { String whereClause = ""; String valueClause = ""; switch (searchType) { case ID:/*from w w w . j av a2 s . c o m*/ whereClause = "id = ?"; valueClause = value.toString(); break; case NICKNAME: whereClause = "nickname LIKE ?"; valueClause = "%" + value.toString() + "%"; break; case PASSWORD: whereClause = "password = ?"; valueClause = value.toString(); break; case EMAIL: whereClause = "email LIKE ?"; valueClause = "%" + value.toString() + "%"; break; case ADMINISTRATOR: whereClause = "administrator = ?"; valueClause = value.toString(); break; default: throw new AssertionError(searchType.name()); } try { return dbAccess.query(con, "SELECT * FROM \"User\" WHERE " + whereClause, // proces a row from result to a bean new BeanListHandler<User>(User.class), valueClause); } catch (Exception e) { e.printStackTrace(); } return EMPTY; }
From source file:com.wickettasks.business.services.task.TestTaskService.java
@Test public void testAddTask() { try {//from ww w .j a v a 2 s . c o m Task task = this.taskService.add("adadadadad", this.taskList.getId(), this.user.getId()); Task foundTask = this.taskService.findByTaskIdAndUserId(task.getId(), this.user.getId()); assertEquals(task, foundTask); } catch (AccessRestrictionException e) { throw new AssertionError(e); } }
From source file:com.tc.config.schema.ConfigAutoChooseServerTest.java
public void testConfigAutoChooseThisL2() { try {/* ww w. j av a 2 s.c om*/ tcConfig = getTempFile("tc-config-test.xml"); String config = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + "\n<tc-config xmlns=\"http://www.terracotta.org/config\">" + "\n<servers>" + "\n <server name=\"server1\" host=\"%i\">" + "\n <logs>" + System.getProperty("user.home") + "/terracotta/server1-logs</logs>" + "\n <tsa-port>9510</tsa-port>" + "\n <tsa-group-port>9530</tsa-group-port>" + "\n </server>" + "\n <server name=\"server2\" host=\"11.0.1.2\">" + "\n <logs>" + System.getProperty("user.home") + "/terracotta/server2-logs</logs>" + "\n <tsa-port>8510</tsa-port>" + "\n</server>" + "\n <server name=\"server3\" host=\"11.0.1.3\">" + "\n <logs>" + System.getProperty("user.home") + "/terracotta/server2-logs</logs>" + "\n <tsa-port>7510</tsa-port>" + "\n <tsa-group-port>7555</tsa-group-port>" + "\n</server>" + "\n</servers>" + "\n</tc-config>"; writeConfigFile(config); StandardConfigurationSetupManagerFactory factory = new StandardConfigurationSetupManagerFactory( new String[] { "-f", tcConfig.getAbsolutePath() }, null, null); L2ConfigurationSetupManager configSetupMgr = factory.createL2TVSConfigurationSetupManager(null, getClass().getClassLoader()); Assert.assertEquals(9510, configSetupMgr.dsoL2Config().tsaPort().getValue()); Assert.assertEquals(9530, configSetupMgr.dsoL2Config().tsaGroupPort().getValue()); } catch (Throwable e) { throw new AssertionError(e); } }
From source file:com.aerospike.delivery.db.base.Database.java
public static void assertReadLocked(ReentrantReadWriteLock lock) { if (lock.getReadLockCount() == 0) { throw new AssertionError("Call this operation from inside withReadLocked()."); }//from www. j a va 2 s. c om }
From source file:com.discovery.darchrow.util.ResourceBundleUtil.java
/** Don't let anyone instantiate this class. */ private ResourceBundleUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }