// Path: src/main/java/org/jmxtrans/agent/util/io/Resource.java
// public interface Resource {
//     /**
//      * Return an {@link InputStream}.
//      * <p>It is expected that each call creates a <i>fresh</i> stream.
//      * @return the input stream for the underlying resource (must not be {@code null})
//      * @throws IoRuntimeException if the stream could not be opened
//      */
//     @Nonnull
//     InputStream getInputStream();
// 
//     /**
//      * Return whether this resource actually exists in physical form.
//      * <p>This method performs a definitive existence check, whereas the
//      * existence of a {@code Resource} handle only guarantees a
//      * valid descriptor handle.
//      */
//     boolean exists();
// 
//     /**
//      * Return a URL handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as URL,
//      * i.e. if the resource is not available as descriptor
//      */
//     @Nonnull
//     URL getURL();
// 
//     /**
//      * Return a URI handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as URI,
//      * i.e. if the resource is not available as descriptor
//      */
//     @Nonnull
//     URI getURI();
// 
//     /**
//      * Return a File handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as absolute
//      * file path, i.e. if the resource is not available in a file system
//      */
//     @Nonnull
//     File getFile();
// 
//     /**
//      * Determine the last-modified timestamp for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved
//      * (in the file system or as some other known physical resource type)
//      */
//     long lastModified();
// 
//     /**
//      * Return a description for this resource,
//      * to be used for error output when working with the resource.
//      * <p>Implementations are also encouraged to return this value
//      * from their {@code toString} method.
//      * @see Object#toString()
//      */
//     String getDescription();
// }


import org.jmxtrans.agent.util.io.ClasspathResource;
import org.jmxtrans.agent.util.io.Resource;
import org.junit.Test;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.*;
import java.util.List;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.isEmptyString;
import static org.junit.Assert.assertThat;

package org.jmxtrans.agent;




public class RollingFileOutputWriterTest {
    @Test
    public void testWriteQueryResultMulti() throws IOException {
        Path defaultLog =Paths.get("jmxtrans-agent.data");
        Files.deleteIfExists(defaultLog);

// Path: src/main/java/org/jmxtrans/agent/util/io/Resource.java
// public interface Resource {
//     /**
//      * Return an {@link InputStream}.
//      * <p>It is expected that each call creates a <i>fresh</i> stream.
//      * @return the input stream for the underlying resource (must not be {@code null})
//      * @throws IoRuntimeException if the stream could not be opened
//      */
//     @Nonnull
//     InputStream getInputStream();
// 
//     /**
//      * Return whether this resource actually exists in physical form.
//      * <p>This method performs a definitive existence check, whereas the
//      * existence of a {@code Resource} handle only guarantees a
//      * valid descriptor handle.
//      */
//     boolean exists();
// 
//     /**
//      * Return a URL handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as URL,
//      * i.e. if the resource is not available as descriptor
//      */
//     @Nonnull
//     URL getURL();
// 
//     /**
//      * Return a URI handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as URI,
//      * i.e. if the resource is not available as descriptor
//      */
//     @Nonnull
//     URI getURI();
// 
//     /**
//      * Return a File handle for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved as absolute
//      * file path, i.e. if the resource is not available in a file system
//      */
//     @Nonnull
//     File getFile();
// 
//     /**
//      * Determine the last-modified timestamp for this resource.
//      * @throws IoRuntimeException if the resource cannot be resolved
//      * (in the file system or as some other known physical resource type)
//      */
//     long lastModified();
// 
//     /**
//      * Return a description for this resource,
//      * to be used for error output when working with the resource.
//      * <p>Implementations are also encouraged to return this value
//      * from their {@code toString} method.
//      * @see Object#toString()
//      */
//     String getDescription();
// }


// Path: src/test/java/org/jmxtrans/agent/RollingFileOutputWriterTest.java
import org.jmxtrans.agent.util.io.ClasspathResource;
import org.jmxtrans.agent.util.io.Resource;
import org.junit.Test;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.*;
import java.util.List;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.isEmptyString;
import static org.junit.Assert.assertThat;

package org.jmxtrans.agent;




public class RollingFileOutputWriterTest {
    @Test
    public void testWriteQueryResultMulti() throws IOException {
        Path defaultLog =Paths.get("jmxtrans-agent.data");
        Files.deleteIfExists(defaultLog);

        Resource resource = new ClasspathResource("classpath:jmxtrans-config-rolling-multi-test.xml");
