@Test public void shouldSendFileToFtpLocation() throws Exception { DefaultCamelContext camelContext = mock(DefaultCamelContext.class); ProducerTemplate producerTemplate = mock(ProducerTemplate.class); whenNew(DefaultCamelContext.class).withNoArguments().thenReturn(camelContext); when(camelContext.createProducerTemplate()).thenReturn(producerTemplate); OrderFtpSender orderFtpSender = new OrderFtpSender(); FacilityFtpDetails facilityFtpDetails = getFacilityFtpDetails(); File file = mock(File.class); String fileName = "dummyfile"; when(file.getName()).thenReturn(fileName); orderFtpSender.sendFile(facilityFtpDetails, file); verify(producerTemplate).sendBodyAndHeader("ftp: }
public void sendFile(FacilityFtpDetails supplyingFacility, File file) { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBodyAndHeader(createFtpUri(supplyingFacility), file, Exchange.FILE_NAME, file.getName()); }
OrderFtpSender { public void sendFile(FacilityFtpDetails supplyingFacility, File file) { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBodyAndHeader(createFtpUri(supplyingFacility), file, Exchange.FILE_NAME, file.getName()); } }
OrderFtpSender { public void sendFile(FacilityFtpDetails supplyingFacility, File file) { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBodyAndHeader(createFtpUri(supplyingFacility), file, Exchange.FILE_NAME, file.getName()); }  }
OrderFtpSender { public void sendFile(FacilityFtpDetails supplyingFacility, File file) { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBodyAndHeader(createFtpUri(supplyingFacility), file, Exchange.FILE_NAME, file.getName()); }  void sendFile(FacilityFtpDetails supplyingFacility, File file); }
OrderFtpSender { public void sendFile(FacilityFtpDetails supplyingFacility, File file) { CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createProducerTemplate(); template.sendBodyAndHeader(createFtpUri(supplyingFacility), file, Exchange.FILE_NAME, file.getName()); }  void sendFile(FacilityFtpDetails supplyingFacility, File file);  }