Skip to content

Commit ce3097a

Browse files
fixed #222, fixed #217, working on #215, working on #200
1 parent 4eec3eb commit ce3097a

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

src/main/java/org/woehlke/twitterwall/oodm/entities/Mention.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,22 +280,19 @@ public String toString() {
280280
public boolean equals(Object o) {
281281
if (this == o) return true;
282282
if (!(o instanceof Mention)) return false;
283-
if (!super.equals(o)) return false;
284283

285284
Mention mention = (Mention) o;
286285

287-
if (getId() != null ? !getId().equals(mention.getId()) : mention.getId() != null) return false;
288-
if (getIdTwitter() != null ? !getIdTwitter().equals(mention.getIdTwitter()) : mention.getIdTwitter() != null)
289-
return false;
290-
return getScreenName() != null ? getScreenName().equals(mention.getScreenName()) : mention.getScreenName() == null;
286+
if (id != null ? !id.equals(mention.id) : mention.id != null) return false;
287+
if (idTwitter != null ? !idTwitter.equals(mention.idTwitter) : mention.idTwitter != null) return false;
288+
return screenNameUnique != null ? screenNameUnique.equals(mention.screenNameUnique) : mention.screenNameUnique == null;
291289
}
292290

293291
@Override
294292
public int hashCode() {
295-
int result = super.hashCode();
296-
result = 31 * result + (getId() != null ? getId().hashCode() : 0);
297-
result = 31 * result + (getIdTwitter() != null ? getIdTwitter().hashCode() : 0);
298-
result = 31 * result + (getScreenName() != null ? getScreenName().hashCode() : 0);
293+
int result = id != null ? id.hashCode() : 0;
294+
result = 31 * result + (idTwitter != null ? idTwitter.hashCode() : 0);
295+
result = 31 * result + (screenNameUnique != null ? screenNameUnique.hashCode() : 0);
299296
return result;
300297
}
301298
}

src/test/java/org/woehlke/twitterwall/oodm/service/UserServiceTest.java

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.woehlke.twitterwall.oodm.entities.*;
2222
import org.woehlke.twitterwall.oodm.entities.transients.Object2Entity;
2323

24+
import java.util.Set;
25+
2426
import static org.woehlke.twitterwall.frontend.controller.common.ControllerHelper.FIRST_PAGE_NUMBER;
2527

2628
@RunWith(SpringRunner.class)
@@ -326,29 +328,35 @@ public void findAllUser2Media() throws Exception {
326328

327329

328330
//@Commit
329-
@Ignore
331+
//@Ignore
330332
@Test
331333
public void findAllUser2Mentiong() throws Exception {
332334
String msg = "findAllUser2Mentiong: ";
333335
int page=1;
334336
int size=10;
335337
Pageable pageRequest = new PageRequest(page,size);
336338
Page<Object2Entity> foundPage = userService.findAllUser2Mentiong(pageRequest);
337-
if(foundPage.getTotalElements()>0){
338-
for(Object2Entity object2Entity:foundPage.getContent()){
339-
long objectId = object2Entity.getObjectId();
340-
String objectInfo = object2Entity.getObjectInfo();
341-
long entityId = object2Entity.getEntityId();
342-
String entityInfo = object2Entity.getObjectInfo();
343-
User userPers = userService.findById(objectId);
344-
Mention mentionPers = mentionService.findById(entityId);
345-
Assert.assertNotNull(msg,userPers);
346-
Assert.assertNotNull(msg,mentionPers);
347-
Assert.assertNull(objectInfo);
348-
Assert.assertNull(entityInfo);
349-
boolean ok = userPers.getEntities().getMentions().contains(mentionPers);
350-
Assert.assertTrue(msg,ok);
351-
}
339+
for(Object2Entity object2Entity:foundPage.getContent()){
340+
long objectId = object2Entity.getObjectId();
341+
log.info(msg+" objectId: "+objectId);
342+
String objectInfo = object2Entity.getObjectInfo();
343+
log.info(msg+" objectInfo: "+objectInfo);
344+
long entityId = object2Entity.getEntityId();
345+
log.info(msg+" entityId: "+entityId);
346+
String entityInfo = object2Entity.getObjectInfo();
347+
log.info(msg+" entityInfo: "+entityInfo);
348+
User userPers = userService.findById(objectId);
349+
log.info(msg+" userPers: "+userPers);
350+
Mention mentionPers = mentionService.findById(entityId);
351+
log.info(msg+" mentionPers: "+mentionPers);
352+
Assert.assertNotNull(msg+" userPers: ",userPers);
353+
Assert.assertNotNull(msg+" mentionPers: ",mentionPers);
354+
Assert.assertNull(msg+" objectInfo: " ,objectInfo);
355+
Assert.assertNull(msg+" entityInfo: ",entityInfo);
356+
Set<Mention> mentions = userPers.getEntities().getMentions();
357+
Assert.assertTrue(msg,mentions.size()>0);
358+
boolean ok = mentions.contains(mentionPers);
359+
Assert.assertTrue(msg,ok);
352360
}
353361
}
354362

0 commit comments

Comments
 (0)