### Question:
RhinoAspect extends BaseSakuliAspect { protected StringBuilder createLoggingString(JoinPoint joinPoint, LogToResult logToResult) { if (logToResult.logArgsOnly()) { return new StringBuilder(removeEnd(removeStart(printArgs(joinPoint, logToResult.logArgs()), "["), "]")); } StringBuilder message = new StringBuilder(); if (logToResult.logClassInstance() && joinPoint.getTarget() != null) { message.append("\"").append(joinPoint.getTarget().toString()).append("\" "); } message.append(getClassAndMethodAsString(joinPoint)); if (isNotEmpty(logToResult.message())) { message.append(" - ").append(logToResult.message()); } if (ArrayUtils.isNotEmpty(joinPoint.getArgs())) { message.append(" with arg(s) ").append(printArgs(joinPoint, logToResult.logArgs())); } return message; }  @After("execution(* net.sf.sahi.rhino.RhinoScriptRunner.setReporter*(*))") void getRhinoScriptRunner(JoinPoint joinPoint); @Before("execution(* org.sakuli.actions.*.*(..)) &&" + "@annotation(logToResult)") void doTestCaseActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.screenbased.*.*(..)) &&" + "@annotation(logToResult)") void doScreenBasedActionLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.environment.*.*(..)) &&" + "@annotation(logToResult)") void doEnvironmentLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* org.sakuli.actions.logging.*.*(..)) &&" + "@annotation(logToResult)") void doLoggingLog(JoinPoint joinPoint, LogToResult logToResult); @Before("execution(* net.sf.sahi.report.Report.addResult(..))") void doHandleRhinoException(JoinPoint joinPoint); static final String ALREADY_PROCESSED; }### Answer:
@Test public void testCreateLoggingString() throws Exception { JoinPoint jp = mock(JoinPoint.class); when(jp.getArgs()).thenReturn(new Object[]{"TEST", "arguments"}); LogToResult annotation = mock(LogToResult.class); when(annotation.logArgsOnly()).thenReturn(true); when(annotation.logArgs()).thenReturn(true); StringBuilder result = BeanLoader.loadBean(RhinoAspect.class).createLoggingString(jp, annotation); assertEquals(result.toString(), "TEST, arguments"); }