test_class.file: server/src/test/java/io/spine/server/tenant/TenantAwareOperationTest.java
test_class.identifier: TenantAwareOperationTest
test_case.body: @Test
      @DisplayName("clear current tenant on restoring if no tenant was set")
      void clearCurrentTenant() {
          // Make sure there's not current tenant.
          CurrentTenant.clear();
  
          // Create new operation.
          TenantId newTenant = generate();
          TenantAwareOperation op = createOperation(newTenant);
  
          // Check that the construction did not set the tenant.
          assertFalse(CurrentTenant.get()
                                   .isPresent());
  
          op.execute();
  
          // Check that the execution was on the correct tenant.
          assertEquals(newTenant, getTenantFromRun(op));
  
          // Check that the execution cleared the current tenant.
          assertFalse(CurrentTenant.get()
                                   .isPresent());
      }
test_case.class_method_signature: TenantAwareOperationTest.clearCurrentTenant()
test_case.full_signature: @Test @DisplayName("clear current tenant on restoring if no tenant was set") void clearCurrentTenant()
test_case.identifier: clearCurrentTenant
test_case.invocations: clear generate createOperation assertFalse isPresent get execute assertEquals getTenantFromRun assertFalse isPresent get
test_case.modifiers: @Test @DisplayName("clear current tenant on restoring if no tenant was set")
test_case.parameters: ()
test_case.return: void
test_case.signature: void clearCurrentTenant()
focal_class.file: server/src/main/java/io/spine/server/tenant/TenantAwareOperation.java
focal_class.identifier: TenantAwareOperation
focal_class.interfaces: implements Runnable
focal_class.class_method_signature: TenantAwareOperation.TenantAwareOperation()
focal_class.full_signature: protected  TenantAwareOperation()
focal_class.identifier: TenantAwareOperation
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  TenantAwareOperation()
focal_class.class_method_signature: TenantAwareOperation.TenantAwareOperation(TenantId tenantId)
focal_class.full_signature: protected  TenantAwareOperation(TenantId tenantId)
focal_class.identifier: TenantAwareOperation
focal_class.modifiers: protected
focal_class.parameters: (TenantId tenantId)
focal_class.signature:  TenantAwareOperation(TenantId tenantId)
focal_class.class_method_signature: TenantAwareOperation.execute()
focal_class.full_signature: public void execute()
focal_class.identifier: execute
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void execute()
focal_class.superclass: extends TenantAware
focal_method.body: public void execute() {
          Optional<TenantId> remembered = CurrentTenant.get();
          try {
              CurrentTenant.set(tenantId());
              run();
          } finally {
              if (remembered.isPresent()) {
                  CurrentTenant.set(remembered.get());
              } else {
                  CurrentTenant.clear();
              }
          }
      }
focal_method.class_method_signature: TenantAwareOperation.execute()
focal_method.full_signature: public void execute()
focal_method.identifier: execute
focal_method.invocations: get set tenantId run isPresent set get clear
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void execute()