@Test public void getApplicationVersionByUserApplicationAppState() { User user = getUser(UserRole.ROLE_ORG_ADMIN, UserRole.ROLE_GROUP_USER); user = userService.getByEmail(user.getEmail()); List<ApplicationVersion> applicationVersions = userService.getApplicationVersions(user); for (ApplicationVersion applicationVersion : applicationVersions) { applicationVersions = userService.getApplicationVersions( user, applicationVersion.getApplication().getId(), SortOrder.ASCENDING, AppState.ORGANIZATION_PUBLISH, AppState.GROUP_PUBLISH); assertTrue(applicationVersions.size() == 1); } }
private Application createApplication( Category category, String applicationName, AppState appState) { Application application = new Application(); application.setName(applicationName); application.setApplicationType(ApplicationType.ANDROID); application.setCategory(category); ApplicationVersion applicationVersion = new ApplicationVersion(); applicationVersion.setVersionName("1.0.0"); applicationVersion.setApplication(application); applicationVersion.setAppState(appState); application.getApplicationVersions().add(applicationVersion); entityManager.flush(); return application; }