@Test public void shouldNotRegisterProviderWhenProviderObjectsIsEmptyWithoutException() { Type type = new TypeToken<TaskDataProvider>() { }.getType(); TaskDataProvider provider = new TaskDataProvider(); when(motechJsonReader.readFromStream(inputStream, type)).thenReturn(provider); taskDataProviderService.registerProvider(inputStream); verify(dataProviderDataService, never()).create(provider); }
@Override @Transactional public void registerProvider(final String body) { byte[] bytes = body.getBytes(Charset.forName("UTF-8")); InputStream stream = new ByteArrayInputStream(bytes); registerProvider(stream); }
TaskDataProviderServiceImpl implements TaskDataProviderService, OsgiServiceLifecycleListener { @Override @Transactional public void registerProvider(final String body) { byte[] bytes = body.getBytes(Charset.forName("UTF-8")); InputStream stream = new ByteArrayInputStream(bytes); registerProvider(stream); } }
TaskDataProviderServiceImpl implements TaskDataProviderService, OsgiServiceLifecycleListener { @Override @Transactional public void registerProvider(final String body) { byte[] bytes = body.getBytes(Charset.forName("UTF-8")); InputStream stream = new ByteArrayInputStream(bytes); registerProvider(stream); } @Autowired  TaskDataProviderServiceImpl(EventRelay eventRelay);  TaskDataProviderServiceImpl(EventRelay eventRelay, MotechJsonReader motechJsonReader); }
TaskDataProviderServiceImpl implements TaskDataProviderService, OsgiServiceLifecycleListener { @Override @Transactional public void registerProvider(final String body) { byte[] bytes = body.getBytes(Charset.forName("UTF-8")); InputStream stream = new ByteArrayInputStream(bytes); registerProvider(stream); } @Autowired  TaskDataProviderServiceImpl(EventRelay eventRelay);  TaskDataProviderServiceImpl(EventRelay eventRelay, MotechJsonReader motechJsonReader); @Override @Transactional void registerProvider(final String body); @Override @Transactional void registerProvider(final InputStream stream); @Override @Transactional TaskDataProvider getProvider(String name); @Override @Transactional TaskDataProvider getProviderById(Long providerId); @Override @Transactional List<TaskDataProvider> getProviders(); @Override @Transactional void bind(Object service, Map properties); @Override void unbind(Object service, Map properties); @Override @Transactional void unregister(String providerName); }
TaskDataProviderServiceImpl implements TaskDataProviderService, OsgiServiceLifecycleListener { @Override @Transactional public void registerProvider(final String body) { byte[] bytes = body.getBytes(Charset.forName("UTF-8")); InputStream stream = new ByteArrayInputStream(bytes); registerProvider(stream); } @Autowired  TaskDataProviderServiceImpl(EventRelay eventRelay);  TaskDataProviderServiceImpl(EventRelay eventRelay, MotechJsonReader motechJsonReader); @Override @Transactional void registerProvider(final String body); @Override @Transactional void registerProvider(final InputStream stream); @Override @Transactional TaskDataProvider getProvider(String name); @Override @Transactional TaskDataProvider getProviderById(Long providerId); @Override @Transactional List<TaskDataProvider> getProviders(); @Override @Transactional void bind(Object service, Map properties); @Override void unbind(Object service, Map properties); @Override @Transactional void unregister(String providerName);  }