@Test public void multipleCallsAreDelegatedToFiler() throws IOException{ Filer filer = mock(Filer.class); FileObject fileObject = mock(FileObject.class); when(filer.createResource(Mockito.<Location> any(), anyString(), anyString())).thenReturn(fileObject); ResourceCodeWriter resourceCodeWriter = new ResourceCodeWriter(filer); JPackage jPackage = new JCodeModel()._package("some.package"); resourceCodeWriter.openBinary(jPackage, null); resourceCodeWriter.openBinary(jPackage, null); verify(filer, times(2)).createResource(Mockito.<Location> any(), anyString(), anyString()); }
@Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { FileObject resource = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg.name(), fileName); return resource.openOutputStream(); }
ResourceCodeWriter extends CodeWriter { @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { FileObject resource = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg.name(), fileName); return resource.openOutputStream(); } }
ResourceCodeWriter extends CodeWriter { @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { FileObject resource = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg.name(), fileName); return resource.openOutputStream(); } ResourceCodeWriter(Filer filer); }
ResourceCodeWriter extends CodeWriter { @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { FileObject resource = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg.name(), fileName); return resource.openOutputStream(); } ResourceCodeWriter(Filer filer); @Override OutputStream openBinary(JPackage pkg, String fileName); @Override void close(); }
ResourceCodeWriter extends CodeWriter { @Override public OutputStream openBinary(JPackage pkg, String fileName) throws IOException { FileObject resource = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg.name(), fileName); return resource.openOutputStream(); } ResourceCodeWriter(Filer filer); @Override OutputStream openBinary(JPackage pkg, String fileName); @Override void close();  }