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