本文整理汇总了Java中org.springframework.util.Assert.isNull方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.isNull方法的具体用法?Java Assert.isNull怎么用?Java Assert.isNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.Assert
的用法示例。
在下文中一共展示了Assert.isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testComposedConfiguration
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
@DirtiesContext
public void testComposedConfiguration() throws Exception {
JobExecution jobExecution = this.jobRepository.createJobExecution(
"ComposedTest", new JobParameters());
job.execute(jobExecution);
Map<String, String> props = new HashMap<>(1);
props.put("format", "yyyy");
assertEquals(1010, composedTaskProperties.getMaxWaitTime());
assertEquals(1100, composedTaskProperties.getIntervalTimeBetweenChecks());
assertEquals("http://bar", composedTaskProperties.getDataflowServerUri().toASCIIString());
List<String> args = new ArrayList<>(1);
args.add("--baz=boo");
Assert.isNull(job.getJobParametersIncrementer(), "JobParametersIncrementer must be null.");
verify(this.taskOperations).launch("AAA", props, args);
}
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:19,代码来源:ComposedTaskRunnerConfigurationWithPropertiesTests.java
示例2: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public EAccount create(EUser user) {
EAccount existing = findByName(user.getUsername());
Assert.isNull(existing, "account already exists: " + user.getUsername());
authClient.createUser(user);
EAccount account = new EAccount();
account.setFullName(user.getUsername());
//accountMapper.insert(account);
log.info("new account has been created: " + account.getFullName());
return account;
}
示例3: checkNewProject
import org.springframework.util.Assert; //导入方法依赖的package包/类
private boolean checkNewProject(Project helpProject) {
Project existingProject = projectDao.loadProject(helpProject.getName());
boolean newProject = false;
if (helpProject.getId() == null) {
helpProject.setCreatedBy(AuthUtils.getCurrentUserId());
helpProject.setCreatedDate(new Date());
// for new project ensure that there is no project with this name
Assert.isNull(existingProject, MessageHelper.getMessage(MessagesConstants.ERROR_PROJECT_NAME_EXISTS,
helpProject.getName()));
newProject = true;
} else {
// for updated one - ensure that if there is a project with that name,
// its ID is equal to this project's id
Assert.isTrue(existingProject == null || existingProject.getId().equals(helpProject.getId()),
MessageHelper.getMessage(MessagesConstants.ERROR_PROJECT_NAME_EXISTS, helpProject.getName()));
}
return newProject;
}
示例4: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public Account create(User user) {
Account existing = repository.findByUsername(user.getUsername());
Assert.isNull(existing, "account already exist: " + user.getUsername());
log.info("Trying to create user: " + user.getUsername() + " -> " + user.getPassword());
Account account = new Account();
account.setUsername(user.getUsername());
account.setFirstName(user.getFirstName());
account.setLastName(user.getLastName());
account.setEmail(user.getEmail());
account.setAddress(user.getAddress());
account.setPhoneNumber(user.getPhoneNumber());
account = repository.save(account);
authClient.createUser(user);
log.info("New account has been created:" + account.getEmail());
return account;
}
示例5: add
import org.springframework.util.Assert; //导入方法依赖的package包/类
public WxButtonItem add(WxButton wxButton) {
WxButtonItem buttonItem = WxButtonItem.builder()
.setGroup(wxButton.group())
.setType(wxButton.type())
.setMain(wxButton.main())
.setOrder(wxButton.order())
.setKey(wxButtonEventKeyStrategy.getEventKey(wxButton))
.setMediaId(wxButton.mediaId())
.setName(wxButton.name())
.setUrl(wxButton.url()).build();
if (wxButton.main()) {
Assert.isNull(mainButtonLookup.get(wxButton.group()), String.format("已经存在该分组的主菜单,分组是%s", wxButton.group()));
mainButtonLookup.put(wxButton.group(), buttonItem);
} else {
// 可以校验不要超过五个,或者忽略最后的
groupButtonLookup.add(wxButton.group(), buttonItem);
}
if (!StringUtils.isEmpty(wxButton.key())) {
buttonKeyLookup.put(wxButton.key(), buttonItem);
}
buttons.add(buttonItem);
return buttonItem;
}
示例6: testComposedConfiguration
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
@DirtiesContext
public void testComposedConfiguration() throws Exception {
JobExecution jobExecution = this.jobRepository.createJobExecution(
"ComposedTest", new JobParameters());
job.execute(jobExecution);
Assert.isNull(job.getJobParametersIncrementer(), "JobParametersIncrementer must be null.");
verify(this.taskOperations).launch("AAA", new HashMap<String, String>(0), new ArrayList<String>(0));
}
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:11,代码来源:ComposedTaskRunnerConfigurationNoPropertiesTests.java
示例7: destroy
import org.springframework.util.Assert; //导入方法依赖的package包/类
public void destroy(boolean calledFromStart) throws Exception {
if (!stopped) {
if (calledFromStart) {
LOGGER.info("Destroy called from Start");
} else {
LOGGER.info("Destroy called");
}
}
stopped = true;
if (consumationThread != null) {
addCommand(new StopConsumerCommand()); // Va débloquer le Thread de consommation
queue = null; // Ne permet plus de mettre des nouveaux trucs dedans
int cnt = 0;
while (consumationThread != null && cnt < 50) {
if (cnt == 2) {
LOGGER.debug("Waiting for the thread to stop (max 5 sec) ...");
}
Thread.sleep(100);
cnt++;
}
if (consumationThread != null && consumationThread.isAlive() && !consumationThread.isInterrupted()) {
LOGGER.info("Thread not stopped by itself. Interrupting ...");
consumationThread.interrupt();
consumationThread.join();
}
Assert.isNull(consumationThread);
}
queue = null;
}
示例8: client
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Set the ID of an OAuth2 client that will be assigned permissions on a credential.
*
* @param zoneId zone ID; must not be {@literal null}
* @param clientId OAuth2 client ID; must not be {@literal null}
* @return the builder
*/
public CredentialPermissionBuilder client(String zoneId, String clientId) {
Assert.notNull(zoneId, "zoneId must not be null");
Assert.notNull(clientId, "clientId must not be null");
Assert.isNull(actor, "only one actor can be specified");
this.actor = Actor.client(zoneId, clientId);
return this;
}
示例9: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void create(User user) {
User existing = repository.findByUsername(user.getUsername());
Assert.isNull(existing, "User already exists: " + user.getUsername());
String hash = encoder.encode(user.getPassword());
user.setPassword(hash);
repository.save(user);
log.info("New user has been created: {}", user.getUsername());
}
示例10: validateResponse
import org.springframework.util.Assert; //导入方法依赖的package包/类
private void validateResponse(Map<String, Object> parsedResponse) {
Assert.isNull(parsedResponse.get("next_url"),
"The response of finding a space by org and space names should contain just one page");
List<Map<String, Object>> resources = getResourcesFromResponse(parsedResponse);
Assert.notNull(resources, "The response of finding a space by org and space names should contain a 'resources' element");
Assert.isTrue(resources.size() <= 1,
"The response of finding a space by org and space names should not have more than one resource element");
}
示例11: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* 创建用户
*
* @param user
* @return
*/
public EUser create(EUser user) {
EUser existing = userDao.fetchByName(user.getUsername());
Assert.isNull(existing, "user already exists: " + user.getUsername());
user.setPassword(passwordEncoder.encode(user.getPassword()));
user.setRoles(roleDao.getDefaultRoles());
EUser newUser = userDao._insert(user);
// ccount.setUser(newUser);
userDao._insertRelation(user, "roles");
// accountDao._insertLinks(account,"user");
log.info("new user has been created: {}-{}", user.getUsername(), newUser.getId());
return newUser;
}
示例12: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Account create(User user) {
Account existing = repository.findByName(user.getUsername());
Assert.isNull(existing, "account already exists: " + user.getUsername());
authClient.createUser(user);
Saving saving = new Saving();
saving.setAmount(new BigDecimal(0));
saving.setCurrency(Currency.getDefault());
saving.setInterest(new BigDecimal(0));
saving.setDeposit(false);
saving.setCapitalization(false);
Account account = new Account();
account.setName(user.getUsername());
account.setLastSeen(new Date());
account.setSaving(saving);
repository.save(account);
log.info("new account has been created: " + account.getName());
return account;
}
示例13: tableDefinitionShouldBeNullWhenTablesIsEmpty
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
public void tableDefinitionShouldBeNullWhenTablesIsEmpty() {
ReflectionTestUtils.setField(tableController, "names", Collections.EMPTY_LIST);
Assert.isNull(tableController.definition("table1"));
}
示例14: tableDefinitionShouldBeNullWhenExceptionIsRaised
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
public void tableDefinitionShouldBeNullWhenExceptionIsRaised() {
when(amazonDynamoDB.describeTable("table1").getTable())
.thenThrow(new AmazonDynamoDBException("test"));
Assert.isNull(tableController.definition("table1"));
}
示例15: create
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void create(User user) {
User existing = repository.findOne(user.getUsername());
Assert.isNull(existing, "user already exists: " + user.getUsername());
String hash = encoder.encode(user.getPassword());
user.setPassword(hash);
repository.save(user);
log.info("new user has been created: {}", user.getUsername());
}