### Question:
ChartDataRequest extends SerializableBase { public ChartDataResponse validate() { ChartDataResponse chartDataResponse = new ChartDataResponse(); if (getType() == null) { chartDataResponse.set(1, "type cannot be null"); return chartDataResponse; } if (getAggregationType() == null) { chartDataResponse.set(1, "aggregationType cannot be null"); return chartDataResponse; } return null; } ChartDataRequest(ChartType chartType, AggregationType aggregationType); ChartDataResponse validate();  }### Answer:
@Test public void validate() { ChartDataRequest chartDataRequest = new ChartDataRequest(); ChartDataResponse response = chartDataRequest.validate(); assertEquals(1, response.getCode()); assertEquals("type cannot be null", response.getMessage()); chartDataRequest.setType(ChartType.LATENCY); response = chartDataRequest.validate(); assertEquals(1, response.getCode()); assertEquals("aggregationType cannot be null", response.getMessage()); chartDataRequest.setAggregationType(AggregationType.MONTHLY); chartDataRequest.setDateTypes(Collections.singletonList(ChartDataType.EXECUTION)); assertNull(chartDataRequest.validate()); }