### Question:
StationServiceImpl implements StationService { @Override public boolean exist(String stationName, HttpHeaders headers) { boolean result = false; if (repository.findByName(stationName) != null) { result = true; } return result; }  @Override Response create(Station station, HttpHeaders headers); @Override boolean exist(String stationName, HttpHeaders headers); @Override Response update(Station info, HttpHeaders headers); @Override Response delete(Station info, HttpHeaders headers); @Override Response query(HttpHeaders headers); @Override Response queryForId(String stationName, HttpHeaders headers); @Override Response queryForIdBatch(List<String> nameList, HttpHeaders headers); @Override Response queryById(String stationId, HttpHeaders headers); @Override Response queryByIdBatch(List<String> idList, HttpHeaders headers);  }### Answer:
@Test public void testExist1() { Station station = new Station(); Mockito.when(repository.findByName(Mockito.anyString())).thenReturn(station); Assert.assertTrue(stationServiceImpl.exist("station_name", headers)); }
@Test public void testExist2() { Mockito.when(repository.findByName(Mockito.anyString())).thenReturn(null); Assert.assertFalse(stationServiceImpl.exist("station_name", headers)); }