3
I need to do a unit test of PlanilhaReader
but this extension ArrayList<String>
and override the method contains. Is there any way to execute it?
@Component
public class PlanilhaReader extends ArrayList<String> {
final String UPLOAD_PATH = PropertiesSingleton.getValue("api.upload.dir");
@Override
public boolean contains(Object o) {
String paramStr = (String)o;
for (String s : this) {
if (paramStr.equalsIgnoreCase(s)) return true;
}
return false;
}
public BasicDBList readMetadados(Planilha planilha) {...}
}
Testing
public class PlanilhaReaderTest {
@Test
public void testReadMetadados() throws Exception {
PlanilhaReader reader = new PlanilhaReader();
Planilha planilha = new Planilha().setPath("552d4cf1ccf2c0a58301a744/55163343b0df070bbc66e1bb6e0c3f9b.xlsx");
reader.readMetadados(planilha);
}
}
When compiling I get the error:
Hot Swap failed
Tomcat 8.0.18: hierarchy change not implemented;
Tomcat 8.0.18: Operation not supported by VM;
PlanilhaReaderTest: hierarchy change not implemented;
PlanilhaReaderTest: Operation not supported by VM;
PlanilhaReaderTest: hierarchy change not implemented;
PlanilhaReaderTest: Operation not supported by VM
Silly question? Because she inherits from
ArrayList<String>
? That sounds like a bad idea!– Victor Stafusa
Because of the "contains", I need it not to be case sensitive.
– Daniela Morais