### Question:
ObjectTypeHandler { public void assertObjectTypeExists(String name, String property) throws InvalidArgumentException { if (objectManager.getObjectType(name) == null) { throw new InvalidArgumentException() .addValidationError(String.format("ObjectType with name = %s does not exist.", name), "object.type.not.exist", property, name); } } @Inject  ObjectTypeHandler(ObjectManager objectManager); void assertObjectTypeExists(String name, String property); void assertObjectTypeNotExists(String name);  }### Answer:
@Test public void testAssertObjectTypeExists() throws InvalidArgumentException { when(objectManager.getObjectType("someObjectType")).thenReturn(new ObjectTypeEntity()); handler.assertObjectTypeExists("someObjectType", "type"); verify(objectManager).getObjectType("someObjectType"); }
@Test public void testNonExistingObjectTypeThrowsException(){ InvalidArgumentException ex = assertThrows(InvalidArgumentException.class, () -> handler.assertObjectTypeExists("someObjectType", "type")); assertEquals(set("object.type.not.exist"), set(ex.getValidationErrors(), InvalidArgumentException.ValidationError::getMessageTemplate)); }