Created
January 27, 2015 01:10
-
-
Save vishwasbabu/95a24bd5d087831c253f to your computer and use it in GitHub Desktop.
Unit Tests on MifosX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringJUnit4ClassRunner.class) | |
@SpringApplicationConfiguration(classes = ServerApplication.Configuration.class) | |
@WebAppConfiguration | |
@IntegrationTest({ "server.port=0", "management.port=0", "mariaDB4j.port=0", "mariaDB4j.dataDir=null" }) | |
public abstract class AbstractSpringBootWithDatabaseIntegrationTest { | |
// do NOT put any helper methods here! | |
// it's much better to use composition instead of inheritance | |
// so write a test util ("fixture") and use it as a field in your test | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SpringBootServerLoginTest extends AbstractSpringBootWithDatabaseIntegrationTest { | |
protected RestAssuredFixture util; | |
@Autowired | |
private ClientRepositoryWrapper clientRepositoryWrapper; | |
@Autowired | |
private AppUserRepository userRepository; | |
@Autowired | |
private BasicAuthTenantDetailsService basicAuthTenantDetailsService; | |
@Test | |
// @Ignore("Failing on Cloubees") | |
public void hasMifosPlatformStarted() { | |
// util = new RestAssuredFixture(8443); | |
//List<Map<String, String>> response = util.httpGet("/users"); | |
//assertThat(response.get(0).get("username"), is("adama")); | |
//System.out.println("Lets create a Client"); | |
final MifosPlatformTenant tenant = this.basicAuthTenantDetailsService.loadTenantById("default"); | |
ThreadLocalContextUtil.setTenant(tenant); | |
List<AppUser> allUsers = this.userRepository.findAll(); | |
for (AppUser appUser : allUsers) { | |
System.out.println(appUser.getUsername()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment