1
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 builder a jsonObject
as a parameter.
There’s no way to instantiate a mock class, so the when
makes an exception.
The test creates an instance of the class ParseProcesso
(but obviously it doesn’t work)... Does anyone have any idea what to do?
You can’t use it
new ParseProcesso(any());
?– igventurelli