Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void createProfileNumeralName() {
- appProfileServiceForDelete = "0123456789";
- HashMap<Integer, String> appProfilesData = new HashMap<>();
- final List<AppProfileService> listProfiles = listProfileService(getAuthToken());
- for (AppProfileService app : listProfiles) {
- appProfilesData.put(app.getId(), app.getName());
- }
- if (appProfilesData.containsValue(appProfileServiceForDelete)) {
- deleteProfileService(searchKeyMap(appProfilesData, appProfileServiceForDelete), getAuthToken());
- }
- ResponseEntity<String> numericalProfileName = createProfileService(getAuthToken(), appProfileServiceForDelete);
- Assert.assertEquals(numericalProfileName.getStatusCode(), HttpStatus.OK);
- HashMap<Integer, String> appProfilesDataAfterDelete = new HashMap<>();
- final List<AppProfileService> listProfilesAfterDelete = listProfileService(getAuthToken());
- for (AppProfileService app : listProfilesAfterDelete) {
- appProfilesDataAfterDelete.put(app.getId(), app.getName());
- }
- System.out.println(appProfilesDataAfterDelete);
- if (listProfiles.isEmpty() || !appProfilesData.containsValue(appProfileServiceForDelete)) {
- deleteProfileService(searchKeyMap(appProfilesDataAfterDelete, appProfileServiceForDelete), getAuthToken());
- }
- }
- public static Integer searchKeyMap(HashMap<Integer, String> map, String value) {
- Iterator it = map.entrySet().iterator();
- Integer key = null;
- while (it.hasNext()) {
- Map.Entry pair = (Map.Entry)it.next();
- if (pair.getValue() == value) {
- key = (Integer) pair.getKey();
- }
- }
- it.remove();
- return key;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement