Start AssertJ Migration
Issue gh-3175
This commit is contained in:
@@ -20,7 +20,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = AspectjSecurityConfig.class)
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
package sample.contact;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ContactManagerTests {
|
||||
makeActiveUser("dianne"); // has ROLE_USER
|
||||
|
||||
List<Contact> contacts = contactManager.getAll();
|
||||
assertEquals(4, contacts.size());
|
||||
assertThat(contacts).hasSize(4);
|
||||
|
||||
assertContainsContact(4, contacts);
|
||||
assertContainsContact(5, contacts);
|
||||
@@ -138,7 +138,7 @@ public class ContactManagerTests {
|
||||
|
||||
List<Contact> contacts = contactManager.getAll();
|
||||
|
||||
assertEquals(4, contacts.size());
|
||||
assertThat(contacts).hasSize(4);
|
||||
|
||||
assertContainsContact(1, contacts);
|
||||
assertContainsContact(2, contacts);
|
||||
@@ -161,7 +161,7 @@ public class ContactManagerTests {
|
||||
|
||||
List<Contact> contacts = contactManager.getAll();
|
||||
|
||||
assertEquals(5, contacts.size());
|
||||
assertThat(contacts).hasSize(5);
|
||||
|
||||
assertContainsContact(4, contacts);
|
||||
assertContainsContact(6, contacts);
|
||||
|
||||
@@ -30,7 +30,7 @@ import samples.DataConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Rob Winch
|
||||
|
||||
Executable → Regular
+8
-8
@@ -1,4 +1,4 @@
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
@@ -40,9 +40,9 @@ public class DmsIntegrationTests extends AbstractTransactionalJUnit4SpringContex
|
||||
|
||||
@Test
|
||||
public void testBasePopulation() {
|
||||
assertEquals(9, (int) jdbcTemplate.queryForObject("select count(id) from DIRECTORY", Integer.class));
|
||||
assertEquals(90, (int) jdbcTemplate.queryForObject("select count(id) from FILE", Integer.class));
|
||||
assertEquals(3, documentDao.findElements(Directory.ROOT_DIRECTORY).length);
|
||||
assertThat(Integer.class)).isEqualTo(9, (int) jdbcTemplate.queryForObject("select count(id) from DIRECTORY");
|
||||
assertThat(Integer.class)).isEqualTo(90, (int) jdbcTemplate.queryForObject("select count(id) from FILE");
|
||||
assertThat(documentDao.findElements(Directory.ROOT_DIRECTORY).length).isEqualTo(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +66,7 @@ public class DmsIntegrationTests extends AbstractTransactionalJUnit4SpringContex
|
||||
System.out.println("------ Test for username: " + username + " ------");
|
||||
AbstractElement[] rootElements = documentDao
|
||||
.findElements(Directory.ROOT_DIRECTORY);
|
||||
assertEquals(3, rootElements.length);
|
||||
assertThat(rootElements.length).isEqualTo(3);
|
||||
Directory homeDir = null;
|
||||
Directory nonHomeDir = null;
|
||||
for (int i = 0; i < rootElements.length; i++) {
|
||||
@@ -81,11 +81,11 @@ public class DmsIntegrationTests extends AbstractTransactionalJUnit4SpringContex
|
||||
System.out.println("Non-home directory..: " + nonHomeDir.getFullName());
|
||||
|
||||
AbstractElement[] homeElements = documentDao.findElements(homeDir);
|
||||
assertEquals(12, homeElements.length); // confidential and shared directories,
|
||||
assertThat(homeElements.length).isEqualTo(12); // confidential and shared directories,
|
||||
// plus 10 files
|
||||
|
||||
AbstractElement[] nonHomeElements = documentDao.findElements(nonHomeDir);
|
||||
assertEquals(shouldBeFiltered ? 11 : 12, nonHomeElements.length); // cannot see
|
||||
assertThat(nonHomeElements.length).isEqualTo(shouldBeFiltered ? 11 : 12); // cannot see
|
||||
// the user's
|
||||
// "confidential"
|
||||
// sub-directory
|
||||
@@ -110,7 +110,7 @@ public class DmsIntegrationTests extends AbstractTransactionalJUnit4SpringContex
|
||||
else {
|
||||
System.out.println("Inaccessible dir....: "
|
||||
+ nonHomeConfidentialDir.getFullName());
|
||||
assertEquals(10, documentDao.findElements(nonHomeConfidentialDir).length); // 10
|
||||
assertThat(documentDao.findElements(nonHomeConfidentialDir).length).isEqualTo(10); // 10
|
||||
// files
|
||||
// (no
|
||||
// sub-directories)
|
||||
|
||||
Executable → Regular
+1
-1
@@ -1,4 +1,4 @@
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package samples.gae.security;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static samples.gae.security.AppRole.*;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -15,15 +15,15 @@ public class AppRoleTests {
|
||||
public void getAuthorityReturnsRoleName() {
|
||||
GrantedAuthority admin = ADMIN;
|
||||
|
||||
assertEquals("ROLE_ADMIN", admin.getAuthority());
|
||||
assertThat(admin.getAuthority()).isEqualTo("ROLE_ADMIN");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bitsAreCorrect() throws Exception {
|
||||
// If this fails, someone has modified the Enum and the Datastore is probably
|
||||
// corrupt!
|
||||
assertEquals(0, ADMIN.getBit());
|
||||
assertEquals(1, NEW_USER.getBit());
|
||||
assertEquals(2, USER.getBit());
|
||||
assertThat(ADMIN.getBit()).isEqualTo(0);
|
||||
assertThat(NEW_USER.getBit()).isEqualTo(1);
|
||||
assertThat(USER.getBit()).isEqualTo(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package samples.gae.users;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
@@ -43,12 +43,12 @@ public class GaeDataStoreUserRegistryTests {
|
||||
|
||||
GaeUser loadedUser = registry.findUser(userId);
|
||||
|
||||
assertEquals(loadedUser.getUserId(), origUser.getUserId());
|
||||
assertEquals(true, loadedUser.isEnabled());
|
||||
assertEquals(roles, loadedUser.getAuthorities());
|
||||
assertEquals("nick", loadedUser.getNickname());
|
||||
assertEquals("nick@blah.com", loadedUser.getEmail());
|
||||
assertEquals("Forename", loadedUser.getForename());
|
||||
assertEquals("Surname", loadedUser.getSurname());
|
||||
assertThat(origUser.getUserId()).isEqualTo(loadedUser.getUserId());
|
||||
assertThat(loadedUser.isEnabled()).isEqualTo(true);
|
||||
assertThat(loadedUser.getAuthorities()).isEqualTo(roles);
|
||||
assertThat(loadedUser.getNickname()).isEqualTo("nick");
|
||||
assertThat(loadedUser.getEmail()).isEqualTo("nick@blah.com");
|
||||
assertThat(loadedUser.getForename()).isEqualTo("Forename");
|
||||
assertThat(loadedUser.getSurname()).isEqualTo("Surname");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user