When it became clear that Germany’s impending military and political collapse was unavoidable, Hitler wrote up a testament naming Admiral Karl Dönitz, the commander-in-chief of the German navy, his successor as Reich President; he then went on to commit suicide in his bunker on April 30, 1945. (Hitler named Goebbels his successor as Reich Chancellor, but Goebbels committed suicide the day after Hitler did.) Dönitz had sharply condemned the July 20th plot against Hitler and was probably named Hitler's successor on account of loyalty. Dönitz was arrested on May 23, 1945, tried before the International Military Tribunal in Nuremberg, and sentenced to ten years in prison.
This photograph shows Hitler and Dönitz during a meeting in Hitler’s bunker in 1945.