Revision ae5bebfa
Added by Andreas Müller about 6 years ago
cdmlib-commons/src/test/java/eu/etaxonomy/cdm/common/CdmUtilsTest.java | ||
---|---|---|
111 | 111 |
|
112 | 112 |
} |
113 | 113 |
|
114 |
@Test |
|
115 |
public void testSomething(){ |
|
116 |
String MCL = "MCL[0-9]{1,3}(\\-[0-9]{1,4}(\\-[0-9]{1,4}(\\-[0-9]{1,3}(\\-[0-9]{1,3})?)?)?)?"; |
|
117 |
// String MCL = "a{1,3}"; |
|
118 |
String filter = "Acc "+MCL; |
|
119 |
|
|
120 |
String notes = "Acc: 0x is Hieracium djimilense subsp. neotericum Zahn MCL293-3140-00-630"; |
|
121 |
String result; |
|
122 |
if (notes.matches("Acc:.*")){ |
|
123 |
if (notes.matches("Acc: .*\\$$") || (notes.matches("Acc: .*"+MCL))){ |
|
124 |
result = null; |
|
125 |
}else if (notes.matches("Acc: .*(\\$|"+MCL+")\\s*\\{.*\\}")){ |
|
126 |
notes = notes.substring(notes.indexOf("{")+1, notes.length()-1); |
|
127 |
result = notes; |
|
128 |
}else if (notes.matches("Acc: .*(\\$|"+MCL+")\\s*\\[.*\\]")){ |
|
129 |
notes = notes.substring(notes.indexOf("[")+1, notes.length()-1); |
|
130 |
result = notes; |
|
131 |
}else{ |
|
132 |
logger.warn("Namenote: " + notes); |
|
133 |
result = notes; |
|
134 |
} |
|
135 |
}else if (notes.matches("Syn:.*")){ |
|
136 |
if (notes.matches("Syn: .*\\$$") || (notes.matches("Syn: .*"+MCL))){ |
|
137 |
result = null; |
|
138 |
}else if (notes.matches("Syn: .*(\\$|"+MCL+")\\s*\\{.*\\}")){ |
|
139 |
notes = notes.substring(notes.indexOf("{")+1, notes.length()-1); |
|
140 |
result = notes; |
|
141 |
}else if (notes.matches("Syn: .*(\\$|"+MCL+")\\s*\\[.*\\]")){ |
|
142 |
notes = notes.substring(notes.indexOf("[")+1, notes.length()-1); |
|
143 |
result = notes; |
|
144 |
}else{ |
|
145 |
logger.warn("Namenote: " + notes); |
|
146 |
result = notes; |
|
147 |
} |
|
148 |
}else{ |
|
149 |
result = notes; |
|
150 |
} |
|
151 |
System.out.println(result); |
|
152 |
} |
|
153 |
|
|
154 | 114 |
} |
Also available in: Unified diff
#7357 revert unwanted commits