Skip to content

Instantly share code, notes, and snippets.

@braghome
Created January 20, 2016 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braghome/77a79a317c9f607b5c1d to your computer and use it in GitHub Desktop.
Save braghome/77a79a317c9f607b5c1d to your computer and use it in GitHub Desktop.
override verifyProfileName(String agentPartnerId, List<UserProfile<Data>> uData) throws AssertionError {
val p = userProfileImpl.getProdUserProfleService(
Z.toString + agentPartnerId
)
LOGGER.info('''matched user profile should have z id «p.data.zuid» name «p.data.name»''')
try {
assertThat(p, notNullValue)
} catch (AssertionError ae) {
throw new AssertionError(ae.getMessage, ae.getCause)
}
val s = !p.data.name.isEmpty
if (s) uData.add(p)
LOGGER.info('''matched user data should have z id «uData.last.data.zuid» name «uData.last.data.name»''')
s
}
def private matchPfrofileName(UserProfile<Data> d) throws AssertionError {
try {
assertThat('''matched user profile should not be null «d»''', d, notNullValue)
} catch (AssertionError ae) {
throw new AssertionError(ae.getMessage, ae.getCause)
}
d
}
override validateMailbox(CrmAgent a, List<UserProfile<Data>> ud) throws AssertionError {
val removeSpace = matchPfrofileName(ud.findFirst[x | {
val s = x.data.zuid.toString
val part = a.partnerId
LOGGER.info('''matched user profile «part» should equal z id «s»''')
x.data.zuid.toString == a.partnerId }]).data
.name
.toLowerCase
try {
assertThat(removeSpace, notNullValue)
assertThat(a.mailbox, equalTo(removeSpace.replaceAll("[^a-zA-Z0-9]", "")))
} catch (AssertionError ae) {
throw new AssertionError(ae.getMessage, ae.getCause)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment