@Test
public void should_load_widget_asset_on_disk_with_content_type_text() throws Exception {

    Path expectedFile = widgetRepositoryPath.resolve("pbLabel/pbLabel.js");
    when(widgetAssetService.findAssetPath("widget-id", "asset.js", AssetType.JAVASCRIPT.getPrefix())).thenReturn(expectedFile);
    mockMvc
            .perform(get("/rest/widgets/widget-id/assets/js/asset.js?format=text"))
            .andExpect(status().isOk())
            .andExpect(content().bytes(readAllBytes(expectedFile)))
            .andExpect(content().contentType(MediaType.TEXT_PLAIN))
            .andExpect(header().string("Content-Length", String.valueOf(expectedFile.toFile().length())))
            .andExpect(header().string("Content-Disposition", "inline; filename=\"pbLabel.js\""))
            .andExpect(content().encoding("UTF-8"));
}