List of usage examples for junit.framework Assert assertTrue
static public void assertTrue(boolean condition)
From source file:com.impetus.kundera.metadata.mappedsuperclass.InvalidSuperClassTest.java
@Test public void setup() { try {// w ww. j a v a 2 s .c om EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); Assert.fail("Should have gone to catch block!"); } catch (MetamodelLoaderException mlex) { Assert.assertTrue(StringUtils.startsWith(mlex.getMessage(), "Class:class com.impetus.kundera.metadata.mappedsuperclass.InvalidPersonEntityis annotated with @MappedSuperClass and @Entity not allowed")); } }
From source file:de.hybris.basecommerce.SimpleSmtpServerUtilsTest.java
@Test public void testStartStop() { SimpleSmtpServer server = null;/*from ww w .ja v a2 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:azkaban.crypto.DecryptionTest.java
@Test public void testV1_1() throws IOException { BasicConfigurator.configure();//w ww. ja va2s . co m Logger.getRootLogger().setLevel(Level.DEBUG); String expected = "test"; String ciphered = "eyJ2ZXIiOiIxLjEiLCJ2YWwiOiJpaE9CM2VzTzBad2F4cHZBV2Z5YUVicHZLQzJBWDJZZnVzS3hVWFN2R3A0PSJ9"; String passphrase = "test1234"; Crypto crypto = new Crypto(); String actual = crypto.decrypt(ciphered, passphrase); Assert.assertEquals(expected, actual); try { new CryptoV1().decrypt(ciphered, passphrase); Assert.fail("Should have failed when decrypt v1.1 ciphered text with v1 decryption."); } catch (Exception e) { Assert.assertTrue(e instanceof RuntimeException); } }
From source file:com.lillicoder.newsblurry.login.LoginResponseParser.java
/** * Parses a new {@link LoginResponse} from the given login response {@link JSONObject}. * @param responseJson Login response {@link JSONObject} to parse. * @return {@link LoginRespone} parsed from the given response JSON. * @throws JSONException Thrown if the given response JSON does not match the expected format. *///from w ww .ja v a 2s . co m public LoginResponse parseLoginResponse(JSONObject responseJson) throws JSONException { Assert.assertTrue(responseJson != null); // TODO add support for errors JSONArray parsing int responseCode = responseJson.getInt(JSON_KEY_REPONSE_CODE); boolean isAuthenticated = responseJson.getBoolean(JSON_KEY_AUTHENTICATED); String resultText = responseJson.getString(JSON_KEY_RESULT_TEXT); return new LoginResponse(responseCode, isAuthenticated, resultText); }
From source file:eagle.dataproc.util.TestConfigOptionParser.java
@Test public void testValidCommandArguments() throws ParseException { String[] arguments = new String[] { "-D", "key1=value1", "-D", "key2=value2", "-D", "key3=value3=something", "-D", "key4=", "-D", "key5=\"--param having whitespace\"" }; Map<String, String> config = new ConfigOptionParser().parseConfig(arguments); Assert.assertTrue(config.containsKey("key1")); Assert.assertTrue(config.containsKey("key2")); Assert.assertTrue(config.containsKey("key3")); Assert.assertTrue(config.containsKey("key4")); Assert.assertEquals("value1", config.get("key1")); Assert.assertEquals("value2", config.get("key2")); Assert.assertEquals("value3=something", config.get("key3")); Assert.assertEquals("", config.get("key4")); Assert.assertEquals("\"--param having whitespace", config.get("key5")); }
From source file:com.googlecode.t7mp.steps.CopySetenvScripStepTest.java
@Before public void setUp() { catalinaBaseDir = Files.createTempDir(); Assert.assertTrue(catalinaBaseDir.exists()); Assert.assertNotNull(catalinaBaseDir); Assert.assertTrue(catalinaBaseDir.exists()); Mockito.when(configuration.getCatalinaBase()).thenReturn(catalinaBaseDir); // Mockito.when(mojo.getLog()).thenReturn(log); }
From source file:com.github.neoio.net.message.staging.file.TestFileMessageStaging.java
@Test public void test_tempRead() { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.put("Hello World".getBytes()); buffer.flip();/*from www. j a va2s . co m*/ staging.writeTempReadBytes(buffer); Assert.assertTrue(staging.hasTempReadBytes()); buffer.clear(); staging.readTempReadBytes(buffer); Assert.assertEquals("Hello World", new String(ArrayUtils.subarray(buffer.array(), 0, "Hello World".getBytes().length))); staging.resetTempReadBytes(); Assert.assertFalse(staging.hasTempReadBytes()); }
From source file:com.nomsic.randb.persistence.xml.RandbXMLPersistenceProviderTest.java
@Test public void testInit() { File file = new File(TEST_DATA_FOLDER); Assert.assertTrue(file.exists()); Assert.assertTrue(file.isDirectory()); file = new File(TEST_DATA_FOLDER + File.separator + "index.xml"); Assert.assertTrue(file.exists());//from w w w.ja v a 2 s .c o m }
From source file:com.googlecode.t7mp.steps.ConfigFilesSequenceTest.java
@Before public void setUp() { catalinaBaseDir = Files.createTempDir(); Assert.assertTrue(catalinaBaseDir.exists()); Assert.assertNotNull(catalinaBaseDir); Assert.assertTrue(catalinaBaseDir.exists()); confDirectory = new File(catalinaBaseDir, "/conf/"); boolean confDirCreated = confDirectory.mkdirs(); Assert.assertTrue(confDirCreated);// w w w . j a va2s. co m Assert.assertNotNull(confDirectory); Assert.assertTrue(confDirectory.exists()); }
From source file:com.nomsic.randb.persistence.xml.JaxbIndexTest.java
@Test public void testWrite() throws RandbException { File file = new File(TARGET_TEST_DATA_INDEX_XML); jaxbUtil.write(new Index(), file); Assert.assertTrue(file.exists()); }