Java Code Examples for org.junit.Assert.assertFalse()

The following are Jave code examples for showing how to use assertFalse() of the org.junit.Assert class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: hadoop   File: FileContextMainOperationsBaseTest.java   View Source Code Vote up 7 votes
private void testRenameDirectoryAsNonExistentDirectory(Rename... options) throws Exception {
  if (!renameSupported()) return;
  
  Path src = getTestRootPath(fc, "test/hadoop/dir");
  fc.mkdir(src, FileContext.DEFAULT_PERM, true);
  createFile(getTestRootPath(fc, "test/hadoop/dir/file1"));
  createFile(getTestRootPath(fc, "test/hadoop/dir/subdir/file2"));
  
  Path dst = getTestRootPath(fc, "test/new/newdir");
  fc.mkdir(dst.getParent(), FileContext.DEFAULT_PERM, true);
  
  rename(src, dst, true, false, true, options);
  Assert.assertFalse("Nested file1 exists", 
      exists(fc, getTestRootPath(fc, "test/hadoop/dir/file1")));
  Assert.assertFalse("Nested file2 exists", 
      exists(fc, getTestRootPath(fc, "test/hadoop/dir/subdir/file2")));
  Assert.assertTrue("Renamed nested file1 exists",
      exists(fc, getTestRootPath(fc, "test/new/newdir/file1")));
  Assert.assertTrue("Renamed nested exists", 
      exists(fc, getTestRootPath(fc, "test/new/newdir/subdir/file2")));
}
 
Example 2
Project: rskj   File: BlockStoreTest.java   View Source Code Vote up 6 votes
@Test
public void removeHeader() {
    BlockStore store = new BlockStore();
    BlockHeader blockHeader = new BlockHeader(new byte[]{},
            new byte[]{},
            new byte[]{},
            new Bloom().getData(),
            new byte[]{},
            1,
            new byte[]{},
            0,
            0,
            new byte[]{},
            new byte[]{},
            new byte[]{},
            new byte[]{},
            new byte[]{},
            0
    );

    store.saveHeader(blockHeader);
    store.removeHeader(blockHeader);
    Assert.assertFalse(store.hasHeader(blockHeader.getHash()));
}
 
Example 3
Project: oscm   File: TriggerQueueServiceLocalTest.java   View Source Code Vote up 6 votes
@Test
public void testSendAllNonSuspendingMessagesWithOrgsBillingType()
        throws Exception {
    List<TriggerDefinition> triggerDefs = new ArrayList<>();
    TriggerDefinition td = new TriggerDefinition();
    td.setType(TriggerType.START_BILLING_RUN);
    td.setSuspendProcess(false);
    triggerDefs.add(td);
    organization.setTriggerDefinitions(triggerDefs);
    TriggerMessage tm = new TriggerMessage(TriggerType.START_BILLING_RUN,
            null, organizations);
    tqs.sendAllNonSuspendingMessages(Collections.singletonList(tm));
    Assert.assertFalse(storedObjects.isEmpty());
    Assert.assertTrue(storedObjects.get(0) instanceof TriggerProcess);
    TriggerProcess storedProcess = (TriggerProcess) storedObjects.get(0);
    Assert.assertEquals(TriggerProcessStatus.INITIAL,
            storedProcess.getStatus());
}
 
Example 4
Project: hadoop-oss   File: FileContextMainOperationsBaseTest.java   View Source Code Vote up 6 votes
private void testRenameDirectoryAsNonExistentDirectory(Rename... options) throws Exception {
  if (!renameSupported()) return;
  
  Path src = getTestRootPath(fc, "test/hadoop/dir");
  fc.mkdir(src, FileContext.DEFAULT_PERM, true);
  createFile(getTestRootPath(fc, "test/hadoop/dir/file1"));
  createFile(getTestRootPath(fc, "test/hadoop/dir/subdir/file2"));
  
  Path dst = getTestRootPath(fc, "test/new/newdir");
  fc.mkdir(dst.getParent(), FileContext.DEFAULT_PERM, true);
  
  rename(src, dst, true, false, true, options);
  Assert.assertFalse("Nested file1 exists", 
      exists(fc, getTestRootPath(fc, "test/hadoop/dir/file1")));
  Assert.assertFalse("Nested file2 exists", 
      exists(fc, getTestRootPath(fc, "test/hadoop/dir/subdir/file2")));
  Assert.assertTrue("Renamed nested file1 exists",
      exists(fc, getTestRootPath(fc, "test/new/newdir/file1")));
  Assert.assertTrue("Renamed nested exists", 
      exists(fc, getTestRootPath(fc, "test/new/newdir/subdir/file2")));
}
 
Example 5
Project: tomcat7   File: TestConnectionState.java   View Source Code Vote up 6 votes
@Test
public void testAutoCommitFalse() throws Exception {
    DataSourceProxy d1 = this.createDefaultDataSource();
    d1.setMaxActive(1);
    d1.setMinIdle(1);
    d1.setMaxIdle(1);
    d1.setJdbcInterceptors(ConnectionState.class.getName());
    d1.setDefaultAutoCommit(Boolean.FALSE);
    Connection c1 = d1.getConnection();
    Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
    c1.setAutoCommit(true);
    Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
    c1.close();
    c1 = d1.getConnection();
    Assert.assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
    d1.close(true);
    Assert.assertTrue("Connection should be closed",c1.isClosed());
}
 
Example 6
Project: java-threading   File: JoinableFutureCollectionTest.java   View Source Code Vote up 6 votes
@Test
public void testJoinUntilEmptyWithOne() {
	AsyncManualResetEvent evt = new AsyncManualResetEvent();
	JoinableFuture<Void> joinable = getJoinableFactory().runAsync(() -> Async.awaitAsync(evt.waitAsync()));

	CompletableFuture<Void> waiter = joinableCollection.joinUntilEmptyAsync();
	Assert.assertFalse(waiter.isDone());
	Futures.runAsync(() -> {
		evt.set();
		return Async.awaitAsync(
			waiter,
			() -> {
				this.testFrame.setContinue(false);
				return Futures.completedNull();
			});
	});

	pushFrame();
}
 
Example 7
Project: rskj   File: ProgramTest.java   View Source Code Vote up 5 votes
@Test
public void returnDataCopyTest() {
    TestContract contract = TestContract.returnDataTest();
    ProgramResult result = contract.executeFunction("testCopy", BigInteger.ZERO);
    Assert.assertFalse(result.isRevert());
    Assert.assertNull(result.getException());
    Assert.assertArrayEquals(
            new Object[] {LOREM_IPSUM},
            contract.functions.get("testCopy").decodeResult(result.getHReturn()));
}
 
Example 8
Project: marklogic-rdf4j   File: MarkLogicRepositoryConnectionTest.java   View Source Code Vote up 5 votes
@Test
public void testAddRemoveInsert() throws org.eclipse.rdf4j.RDF4JException {
	Statement stmt = vf.createStatement(micah, homeTel, micahhomeTel);
	testAdminCon.add(stmt);
	try {
		testAdminCon.begin();
		testAdminCon.remove(stmt);
		Assert.assertEquals("The size of repository must be zero", 0, testAdminCon.size());
		testAdminCon.prepareUpdate(
				"INSERT DATA " + " { <" + micah.stringValue() + "> <#homeTel> \"" + micahhomeTel.doubleValue()
						+ "\"^^<http://www.w3.org/2001/XMLSchema#double>} ",
				"http://marklogicsparql.com/addressbook").execute();

		testAdminCon.commit();
	} catch (Exception e) {
		if (testAdminCon.isActive())
			testAdminCon.rollback();
		Assert.assertTrue("Failed within transaction", 1 > 2);

	} finally {
		if (testAdminCon.isActive())
			testAdminCon.rollback();
	}
	Assert.assertFalse(testAdminCon.isEmpty());
	Assert.assertEquals(1L, testAdminCon.size());

}
 
Example 9
Project: java-threading   File: JoinableFutureCollectionTest.java   View Source Code Vote up 5 votes
@Test
public void testJoinUntilEmptyUsesConfigureAwaitFalse() throws Exception {
	AsyncManualResetEvent evt = new AsyncManualResetEvent();
	JoinableFuture<Void> joinable = getJoinableFactory().runAsync(() -> Async.awaitAsync(Async.configureAwait(evt.waitAsync(), false)));

	CompletableFuture<Void> waiter = joinableCollection.joinUntilEmptyAsync();
	Assert.assertFalse(waiter.isDone());
	evt.set();
	waiter.get(UNEXPECTED_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
}
 
Example 10
Project: NoraUi   File: StepUT.java   View Source Code Vote up 5 votes
@Test
public void testCheckConditionsFalseDoNotMatchStringIPADSL5() {
    gherkinCondition.setExpected(DO_NOT_MATCH_STRING);
    gherkinCondition.setActual("IPADSL");
    conditions.add(gherkinCondition);
    Assert.assertFalse(ci.checkConditions(conditions));
}
 
Example 11
Project: rskj   File: InetAddressBlockTest.java   View Source Code Vote up 5 votes
@Test
public void doesNotContainIPV4WithAlteredByte() throws UnknownHostException {
    InetAddress address = generateIPAddressV4();
    InetAddress address2 = alterByte(address, 2);

    InetAddressBlock mask = new InetAddressBlock(address, 8);

    Assert.assertFalse(mask.contains(address2));
}
 
Example 12
Project: redg   File: JsonFileExplicitAttributeDeciderTest.java   View Source Code Vote up 5 votes
@Test
public void isExplicitAttributeDefinitionMissing() throws Exception {
    JsonFileExplicitAttributeDecider decider =
            new JsonFileExplicitAttributeDecider(new InputStreamReader(getClass().getResourceAsStream("JsonFileExplicitAttributeDeciderTest2.json")));
    Table tableMock = Mockito.mock(Table.class);
    Mockito.when(tableMock.getName()).thenReturn("TABLENAME");
    Column columnMock = Mockito.mock(Column.class);
    Mockito.when(columnMock.getName()).thenReturn("EXPLICIT");
    Mockito.when(columnMock.getParent()).thenReturn(tableMock);
    Assert.assertFalse(decider.isExplicitAttribute(columnMock));

    Mockito.when(columnMock.getName()).thenReturn("NONEXPLICIT");
    Assert.assertFalse(decider.isExplicitAttribute(columnMock));
}
 
Example 13
Project: rskj   File: PrevMinGasPriceValidatorTest.java   View Source Code Vote up 5 votes
@Test
public void noParentBlock() {
    Block block = Mockito.mock(Block.class);

    Mockito.when(block.getParentHash()).thenReturn(PARENT_HASH);
    Mockito.when(block.getMinGasPriceAsInteger()).thenReturn(BLOCK_MGP);

    PrevMinGasPriceRule pmgpv = new PrevMinGasPriceRule();

    Assert.assertFalse(pmgpv.isValid(block, null));
}
 
Example 14
Project: OpenDiabetes   File: AllTests.java   View Source Code Vote up 5 votes
@Test
public void test38() throws Exception {
	String data = "1\r\n\r\n\"\"\r\n \r\n2";

	CsvReader reader = CsvReader.parse(data);
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("1", reader.get(0));
	Assert.assertEquals(0L, reader.getCurrentRecord());
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals("1", reader.getRawRecord());
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("", reader.get(0));
	Assert.assertEquals(1L, reader.getCurrentRecord());
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals("\"\"", reader.getRawRecord());
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("", reader.get(0));
	Assert.assertEquals(2L, reader.getCurrentRecord());
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals(" ", reader.getRawRecord());
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("2", reader.get(0));
	Assert.assertEquals(3L, reader.getCurrentRecord());
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals("2", reader.getRawRecord());
	Assert.assertFalse(reader.readRecord());
	reader.close();
}
 
Example 15
Project: GitHub   File: RetainingFragmentContainerActivityTest.java   View Source Code Vote up 5 votes
@AfterClass
public static void checkPresenterNotRetained(){

  // TODO is there a better way to test after onDestroy() has been called?
  Assert.assertNotNull(presenter);
  Assert.assertEquals(2, presenter.detachViewInvokations);
  Assert.assertFalse(presenter.onDettachViewRetainInstance);

}
 
Example 16
Project: redirector   File: UrlRulesValidatorTest.java   View Source Code Vote up 5 votes
@Test
public void testInvalidBecauseEmptyDefaultUrlRuleStatement() throws Exception {
    URLRules urlRules = new URLRules();
    Default defaultUrlRule = new Default();
    defaultUrlRule.setUrlRule(new UrlRule());
    urlRules.setDefaultStatement(defaultUrlRule);

    Assert.assertFalse(testee.validate(urlRules).isSuccessValidation());
}
 
Example 17
Project: azure-libraries-for-java   File: TestLocalNetworkGateway.java   View Source Code Vote up 5 votes
@Override
public LocalNetworkGateway updateResource(LocalNetworkGateway gateway) throws Exception {
    gateway.update()
            .withoutAddressSpace("192.168.3.0/24")
            .withIPAddress("40.71.184.216")
            .withTag("tag2", "value2")
            .withoutTag("tag1")
            .apply();
    Assert.assertFalse(gateway.addressSpaces().contains("192.168.3.0/24"));
    Assert.assertEquals("40.71.184.216", gateway.ipAddress());
    Assert.assertTrue(gateway.tags().containsKey("tag2"));
    Assert.assertTrue(!gateway.tags().containsKey("tag1"));
    return gateway;
}
 
Example 18
Project: crnk-framework   File: JpaRelationshipRepositoryTestBase.java   View Source Code Vote up 5 votes
@Test
public void testFindManyTargetWithUnmatchedFilter() throws InstantiationException, IllegalAccessException {
	QuerySpec querySpec = new QuerySpec(RelatedEntity.class);
	querySpec.addFilter(new FilterSpec(Arrays.asList("id"), FilterOperator.EQ, 9999));

	Iterable<RelatedEntity> relatedEntities = repo.findManyTargets(1L, TestEntity.ATTR_oneRelatedValue, querySpec);
	Iterator<RelatedEntity> iterator = relatedEntities.iterator();
	Assert.assertFalse(iterator.hasNext());
}
 
Example 19
Project: hadoop-oss   File: FileContextMainOperationsBaseTest.java   View Source Code Vote up 4 votes
@Test
public void testDeleteNonExistentFile() throws IOException {
  Path path = getTestRootPath(fc, "test/hadoop/file");    
  Assert.assertFalse("Doesn't exist", exists(fc, path));
  Assert.assertFalse("No deletion", fc.delete(path, true));
}
 
Example 20
Project: plugin-id   File: CompanyResourceTest.java   View Source Code Vote up 4 votes
@Test
public void findAll() {
	final CompanyOrg companyOrg1 = new CompanyOrg("ou=gfi,ou=france,ou=people,dc=sample,dc=com", "gfi");
	final CompanyOrg companyOrg2 = new CompanyOrg("ou=ing-internal,ou=ing,ou=external,ou=people,dc=sample,dc=com", "ing-internal");
	companyOrg2.setLocked(true);
	final Map<String, UserOrg> users = new HashMap<>();
	final UserOrg user1 = new UserOrg();
	user1.setCompany("france");
	users.put("user1", user1);
	final UserOrg user2 = new UserOrg();
	user2.setCompany("france");
	users.put("user2", user2);
	user2.setCompany("ing-internal");

	Mockito.when(userRepository.findAll()).thenReturn(users);
	Mockito.when(companyRepository.findAll(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any()))
			.thenReturn(new PageImpl<>(Arrays.asList(companyOrg1, companyOrg2)));

	final TableItem<ContainerCountVo> groups = resource.findAll(newUriInfoAscSearch("name", "g"));
	Assert.assertEquals(2, groups.getRecordsTotal());
	final ContainerCountVo group0 = groups.getData().get(0);
	Assert.assertEquals("gfi", group0.getName());
	Assert.assertEquals(0, group0.getCount());
	Assert.assertEquals(0, group0.getCountVisible());
	Assert.assertFalse(group0.isCanAdmin());
	Assert.assertFalse(group0.isCanWrite());
	Assert.assertFalse(group0.isLocked());
	Assert.assertEquals("France", group0.getScope());
	Assert.assertEquals("gfi", group0.getId());
	Assert.assertEquals(ContainerType.COMPANY, group0.getContainerType());

	// No group type case
	final ContainerCountVo group2 = groups.getData().get(1);
	Assert.assertEquals("ing-internal", group2.getName());
	Assert.assertEquals(1, group2.getCount());
	Assert.assertEquals(0, group2.getCountVisible());
	Assert.assertFalse(group2.isCanAdmin());
	Assert.assertFalse(group2.isCanWrite());
	Assert.assertTrue(group2.isLocked());
	Assert.assertEquals("Root", group2.getScope());
	Assert.assertEquals("ing-internal", group2.getId());
	Assert.assertEquals(ContainerType.COMPANY, group2.getContainerType());
}