Skip to content

Commit 6610ab7

Browse files
fixed #222, fixed #217, working on #215, working on #200
1 parent 23e7334 commit 6610ab7

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private Mention() {
9898
@Transient
9999
@Override
100100
public String getUniqueId() {
101-
return idTwitter.toString() +"_"+ screenNameUnique;
101+
return "" + idTwitter +"_"+ screenNameUnique;
102102
}
103103

104104
@Transient
@@ -125,7 +125,13 @@ public boolean isValid() {
125125
if(idTwitter == null){
126126
return false;
127127
}
128-
return (this.getScreenName().compareTo(this.getScreenNameUnique())==0) ;
128+
if(idTwitterOfUser < 0L){
129+
return false;
130+
}
131+
if(this.getScreenName().toLowerCase().compareTo(this.getScreenNameUnique())!=0){
132+
return false;
133+
}
134+
return true;
129135
}
130136

131137
@Transient
@@ -245,6 +251,7 @@ public void setScreenNameUnique(String screenNameUnique) {
245251
this.screenNameUnique = screenNameUnique.toLowerCase();
246252
}
247253

254+
/*
248255
@Override
249256
public String toString() {
250257
return "Mention{" +
@@ -254,6 +261,19 @@ public String toString() {
254261
", name='" + name + '\'' +
255262
super.toString() +
256263
" }\n";
264+
}*/
265+
266+
@Override
267+
public String toString() {
268+
return "Mention{" +
269+
"id=" + id +
270+
", idTwitter=" + idTwitter +
271+
", screenName='" + screenName + '\'' +
272+
", screenNameUnique='" + screenNameUnique + '\'' +
273+
", name='" + name + '\'' +
274+
", idTwitterOfUser=" + idTwitterOfUser +
275+
super.toString() +
276+
'}';
257277
}
258278

259279
@Override

src/main/java/org/woehlke/twitterwall/oodm/entities/parts/AbstractDomainObject.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public String toString() {
7676
myExtraData.append(", ");
7777
myExtraData.append(extraData.get(extraDatumKey));
7878
}
79+
myExtraData.append(" ] ");
7980
myExtraData.append(",\n createdBy=" + this.toStringCreatedBy());
8081
myExtraData.append(",\n updatedBy=" + this.toStringUpdatedBy());
8182
myExtraData.append(",\n taskInfo=" + this.toStringTaskInfo());

src/test/java/org/woehlke/twitterwall/oodm/entities/MentionTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
import org.junit.Assert;
44
import org.junit.Test;
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
57

68
public class MentionTest implements DomainObjectMinimalTest {
79

10+
private static final Logger log = LoggerFactory.getLogger(MentionTest.class);
11+
812
//TODO: #197 https://github.com/phasenraum2010/twitterwall2/issues/197
913
@Test
1014
@Override
@@ -43,7 +47,7 @@ public void getUniqueIdTest() throws Exception {
4347

4448
//TODO: #197 https://github.com/phasenraum2010/twitterwall2/issues/197
4549
@Test
46-
@Override
50+
//@Override
4751
public void isValidTest() throws Exception {
4852
String msg = "isValidTest: ";
4953

@@ -83,8 +87,13 @@ public void isValidTest() throws Exception {
8387
Mention mention2 = new Mention(createdBy,updatedBy,screenName2);
8488
Mention mention3 = new Mention(createdBy,updatedBy,idTwitter3,screenName3,name3);
8589

90+
log.info(msg+" mention1 "+mention1.toString()+" "+mention1.getUniqueId()+" "+mention1.isValid());
8691
Assert.assertTrue(msg,mention1.isValid());
92+
93+
log.info(msg+" mention2 "+mention2.toString()+" "+mention2.getUniqueId()+" "+mention2.isValid());
8794
Assert.assertTrue(msg,mention2.isValid());
95+
96+
log.info(msg+" mention3 "+mention3.toString()+" "+mention3.getUniqueId()+" "+mention3.isValid());
8897
Assert.assertTrue(msg,mention3.isValid());
8998

9099
mention1.setScreenName(null);
@@ -97,11 +106,19 @@ public void isValidTest() throws Exception {
97106
mention4.setIdTwitter(idTwitter4);
98107
mention5.setIdTwitter(idTwitter4);
99108

109+
log.info(msg+" mention1 "+mention1.toString()+" "+mention1.getUniqueId()+" "+mention1.isValid());
100110
Assert.assertFalse(msg,mention1.isValid());
111+
112+
log.info(msg+" mention2 "+mention2.toString()+" "+mention2.getUniqueId()+" "+mention2.isValid());
101113
Assert.assertFalse(msg,mention2.isValid());
102114

115+
log.info(msg+" mention3 "+mention3.toString()+" "+mention3.getUniqueId()+" "+mention3.isValid());
103116
Assert.assertFalse(msg,mention3.isValid());
117+
118+
log.info(msg+" mention4 "+mention4.toString()+" "+mention4.getUniqueId()+" "+mention4.isValid());
104119
Assert.assertFalse(msg,mention4.isValid());
120+
121+
log.info(msg+" mention5 "+mention5.toString()+" "+mention5.getUniqueId()+" "+mention5.isValid());
105122
Assert.assertFalse(msg,mention5.isValid());
106123
}
107124
}

0 commit comments

Comments
 (0)