package com.nulabinc.backlog4j.internal.json;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.TimeZone;

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo") ;

    protected String getJsonString(String resourceFilePath) throws IOException {
        String fileName = SpaceJSONImplTest.class.getClassLoader().getResource(resourceFilePath).getPath();

        byte[] fileContentBytes = Files.readAllBytes(Paths.get(fileName));
        String fileContentStr = new String(fileContentBytes, StandardCharsets.UTF_8);
        return fileContentStr;
    }
}

package com.nulabinc.backlog4j.internal.json;

import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TimeZone;

/**
 * @author nulab-inc
 */
public abstract class AbstractJSONImplTest {

    protected InternalFactoryJSONImpl factory = new InternalFactoryJSONImpl();
    protected TimeZone timeZone = TimeZone.getTimeZone("Asia/Tokyo");

    protected String getJsonString(String resourceFilePath) throws IOException {
        InputStreamReader r = null;
        try {
            r = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceFilePath), "UTF-8");
            CharArrayWriter writer = new CharArrayWriter();
            char buff[] = new char[4096];
            int size;
            while ((size = r.read(buff)) > 0) {
                writer.write(buff, 0, size);
            }
            return writer.toString();
        } finally {
            if (r != null) {
                r.close();
            }
        }
    }
}

Fix to work in Windows
Fix to work in Windows

https://github.com/nulab/backlog4j/issues/49