### Question:
Utilities { public static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId) { if (backend != null && !backend.containsKey(TraceeConstants.SESSION_ID_KEY) && backend.getConfiguration().shouldGenerateSessionId()) { backend.put(TraceeConstants.SESSION_ID_KEY, Utilities.createAlphanumericHash(sessionId, backend.getConfiguration().generatedSessionIdLength())); } } private  Utilities(); static boolean isNullOrEmptyString(final String value); static String createRandomAlphanumeric(final int length); static String createAlphanumericHash(final String str, final int length); static void generateInvocationIdIfNecessary(final TraceeBackend backend); static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId); static final Charset CHARSET_UTF8; }### Answer:
@Test public void ignoreSessionIdGenerationIfBackendIsNull() { Utilities.generateSessionIdIfNecessary(null, "abc"); assertTrue("No exception occurred", true); }
@Test public void dontGenerateSessionIdIfPresentInBackend() { final TraceeBackend backend = SimpleTraceeBackend.createNonLoggingAllPermittingBackend(); backend.put(SESSION_ID_KEY, "ourTestId"); Utilities.generateSessionIdIfNecessary(backend, "123"); assertThat(backend.get(SESSION_ID_KEY), is("ourTestId")); }