### Question:
StaticInstrumentationTransformer { public void transform() { if (config == null) { throw new InvalidConfigEntryException("No configuration provided", null); } Configurator.setRootLevel(config.getLogLevel()); if (agentLoader == null) { throw new AgentLoaderNotProvidedException(); } if (jarLoader == null) { throw new ClassFileLoaderNotProvidedException(); } agentLoader.loadAgent(config, new TransformerExtractor(Injector.createInstrumentation())); log.info(PreprocessConstants.MESSAGE_PREFIX + TransformerExtractor.getTransformers().size() + " Installables loaded."); for (final JarInfo info : jarLoader.load(config)) { applyInstrumentation(info); } }  void transform();  }### Answer:
@Test(expected = InvalidConfigEntryException.class) public void testTransformFailsWithNullConfig(){ StaticInstrumentationTransformer.builder() .config(null) .build() .transform(); }
@Test public void testTransformWorksWithVerboseLogLevel() { config = PreprocessConfig.builder() .agentPath("a path") .jarPath("a path") .logLevel(Level.TRACE) .build(); StaticInstrumentationTransformer.builder() .jarLoader(mockJarPackageLoader) .agentLoader(mockAgentLoader) .config(config) .build().transform(); Assert.assertEquals(Level.TRACE, LogManager.getLogger().getLevel()); }
@Test public void testTransformWorksWithDefaultLogLevel() { spyTransformer.transform(); Assert.assertEquals(LogManager.getLogger().getLevel(), Level.INFO); }
@Test public void testTransformWorksAndInvokesLoadAgentAndPackages() { spyTransformer = Mockito.spy( StaticInstrumentationTransformer.builder() .jarLoader(mockJarPackageLoader) .agentLoader(mockAgentLoader) .config(config) .build() ); spyTransformer.transform(); Mockito.verify(mockAgentLoader).loadAgent(Mockito.any(PreprocessConfig.class), Mockito.any(TransformerExtractor.class)); Mockito.verify(mockJarPackageLoader).load(Mockito.any(PreprocessConfig.class)); }