### Question:
HarmonicLoopRenderer extends BaseRenderer implements IHarmonicLoopRenderer { @Override public void renderHarmonicLoops(String harmonicLoopsTargetPath, String harmonicLoopFileName, HarmonicLoopRenderTransport harmonicLoopRenderTransport) throws Exception { Application.logger.debug("LOG: Start Concatinating HARMONIC loops .."); List<String> sourceFilesList = new ArrayList<String>(); for (HarmonicLoop harmonicLoop : harmonicLoopRenderTransport.getHarmonicLoops()) { if(harmonicLoop != null){ sourceFilesList.add(appConfigs.getHarmonicLoopsFullPath(harmonicLoop)); } } concatenateFiles(sourceFilesList, harmonicLoopsTargetPath + "/" + harmonicLoopFileName); }  @Override void renderHarmonicLoops(String harmonicLoopsTargetPath, String harmonicLoopFileName, HarmonicLoopRenderTransport harmonicLoopRenderTransport); @Override HarmonicLoopRenderTransport extractLoopsToRender(QueueItem queueItem); @Autowired
    public AppConfigs appConfigs; }### Answer:
@Test public void ShouldRenderHarmonicLoopsToCorrectLength() throws Exception { String targetPath = appConfigs.getApplicationRoot(); String fileName = "harmonicLoopRenderTest.wav"; File targetFile = new File(targetPath + fileName); if(targetFile != null && targetFile.exists()){ deleteFolderAndContents(targetFile); } ObjectMapper mapper = new ObjectMapper(); HarmonicLoopRenderTransport harmonicLoopRenderTransport = mapper.readValue(new File(appConfigs.getMockDataDir() + "render\\harmonicLoopsRenderMock.json"), HarmonicLoopRenderTransport.class); harmonicLoopRenderer.renderHarmonicLoops(targetPath, fileName, harmonicLoopRenderTransport); File outPutFile = new File(targetPath + fileName); int bpm = 80; int barCount = 32; float audioLengthInSeconds = audioUtils.getAudioLength(targetPath + fileName); float targetTrackLengthInSeconds = LoopUtils.getSecondsInBar(bpm) * barCount; if(outPutFile != null && outPutFile.exists()){ deleteFolderAndContents(targetFile); } Assert.assertEquals(targetTrackLengthInSeconds, audioLengthInSeconds, 0.02f); }
@Test public void ShouldRenderHarmonicLoopsAltToCorrectLength() throws Exception { String targetPath = appConfigs.getApplicationRoot(); String fileName = "harmonicLoopAltRenderTest.wav"; File targetFile = new File(targetPath + fileName); if(targetFile != null && targetFile.exists()){ deleteFolderAndContents(targetFile); } ObjectMapper mapper = new ObjectMapper(); HarmonicLoopRenderTransport harmonicLoopRenderTransport = mapper.readValue(new File(appConfigs.getMockDataDir() + "render\\harmonicLoopsAltRenderMock.json"), HarmonicLoopRenderTransport.class); harmonicLoopAltRenderer.renderHarmonicLoops(targetPath, fileName, harmonicLoopRenderTransport); File outPutFile = new File(targetPath + fileName); int bpm = 80; int barCount = 32; float audioLengthInSeconds = audioUtils.getAudioLength(targetPath + fileName); float targetTrackLengthInSeconds = LoopUtils.getSecondsInBar(bpm) * barCount; if(outPutFile != null && outPutFile.exists()){ deleteFolderAndContents(targetFile); } Assert.assertEquals(targetTrackLengthInSeconds, audioLengthInSeconds, 0.5f); }