RsJsServices extends AbstractRsJs { @Override List<InputStream> getStreams() { String fwk = null; if("services.ng.js".equals(context.getPath())) { fwk = "ng"; } List<InputStream> streams = new ArrayList<>(); for (Object dataservice : getDataservices()) { if (!OcelotServices.class.isInstance(dataservice)) { addStream(streams, getJsFilename(getUnProxyClassServices().getRealClass(dataservice.getClass()).getName(), fwk)); } } return streams; }    }
@Test public void testGetStreamsNoFwk() { System.out.println("getStreams"); ((FakeCDI) dataservices).add("service1"); ((FakeCDI) dataservices).add("service2"); ((FakeCDI) dataservices).add(new OcelotServices()); ((FakeCDI) dataservices).add("service4"); when(context.getPath()).thenReturn(""); when(unProxyClassServices.getRealClass(eq(String.class))).thenReturn((Class) String.class); doReturn("").when(instance).getJsFilename(anyString(), anyString()); List<InputStream> result = instance.getStreams(); verify(instance, times(3)).addStream(any(List.class), anyString()); verify(instance, times(3)).getJsFilename(eq("java.lang.String"), eq((String) null)); assertThat(result).isNotNull(); }
@Test public void testGetStreamsNgFwk() { System.out.println("getStreams"); ((FakeCDI) dataservices).add("service"); when(context.getPath()).thenReturn("services.ng.js"); when(unProxyClassServices.getRealClass(eq(String.class))).thenReturn((Class) String.class); doReturn("").when(instance).getJsFilename(anyString(), anyString()); List<InputStream> result = instance.getStreams(); verify(instance).addStream(any(List.class), anyString()); verify(instance).getJsFilename(eq("java.lang.String"), eq("ng")); assertThat(result).isNotNull(); }