### Question:
FactTypeRequestResolver { public FactTypeEntity resolveRetractionFactType() { FactTypeEntity typeEntity = factManager.getFactType(RETRACTION_FACT_TYPE_ID); if (typeEntity == null) { typeEntity = factManager.saveFactType(new FactTypeEntity() .setId(RETRACTION_FACT_TYPE_ID) .setNamespaceID(GLOBAL_NAMESPACE) .setName(createRetractionFactTypeName()) .setDefaultConfidence(1.0f) .setValidator("TrueValidator")); } return typeEntity; } @Inject  FactTypeRequestResolver(FactManager factManager); FactTypeEntity fetchExistingFactType(UUID id); FactTypeEntity resolveFactType(String type); FactTypeEntity resolveRetractionFactType();  }### Answer:
@Test public void testResolveRetractionFactType() { FactTypeEntity retraction = new FactTypeEntity(); when(factManager.getFactType(RETRACTION_FACT_TYPE_ID)).thenReturn(retraction); assertSame(retraction, resolver.resolveRetractionFactType()); verify(factManager).getFactType(RETRACTION_FACT_TYPE_ID); verifyNoMoreInteractions(factManager); }
@Test public void testCreateRetractionFactTypeOnDemand() { when(factManager.saveFactType(any())).thenAnswer(i -> i.getArgument(0)); assertRetractionFactType(resolver.resolveRetractionFactType()); verify(factManager).saveFactType(argThat(e -> { assertRetractionFactType(e); return true; })); }
@Test public void testCreateRetractionFactTypeAvoidNameCollision() { when(factManager.getFactType(RETRACTION_FACT_TYPE_NAME)).thenReturn(new FactTypeEntity()); when(factManager.saveFactType(any())).thenAnswer(i -> i.getArgument(0)); assertRetractionFactType(resolver.resolveRetractionFactType()); verify(factManager).saveFactType(argThat(e -> { assertRetractionFactType(e); return true; })); }