public class ParseProcessoTest {
private final String PATTERN_DATA_HORA = "yyyy-MM-dd HH:mm:ss";
JSONObject jsonObject;
@Mock
ParseProcesso parseProcesso;
@Before
public void init(){
jsonObject = new JSONObject("string qualquer");
when(parseProcesso.movimentacaoTemAnexo(new JSONObject("outra string"))).thenReturn(false);
}
@Test
public void testaParse() throws IOException {
ParseProcesso parseProcesso = new ParseProcesso(jsonObject);
Processo processoTeste = parseProcesso.parse();
//demais métodos
The class ParseProcesso
receives in its constructor a jsonObject
as parameter.
There is no way to instantiate a mockada class, so when
throws an exception.
The test creates an instance of class ParseProcesso
(but obviously it does not work) ... Does anyone have any idea what to do?