@Test
public void testMissingRequirements() {

	TableReferenceInfo<ReferenceExampleTable> tableReferenceInfo =
		TableReferenceInfoFactory.create(
			ReferenceExampleTable.CLASS_NAME_ID,
			ReferenceExampleTable.INSTANCE.mainExampleId,
			new MissingRequirementsTableReferenceDefinition());
	Map<Table<?>, List<TableJoinHolder>> parentTableJoinHoldersMap =
		tableReferenceInfo.getParentTableJoinHoldersMap();
	Assert.assertEquals(
		parentTableJoinHoldersMap.toString(), 3,
		parentTableJoinHoldersMap.size());
	_assertMissingRequirementsSQL(
		parentTableJoinHoldersMap.get(MainExampleTable.INSTANCE),
		DSLQueryFactoryUtil.select(
			ReferenceExampleTable.INSTANCE.mainExampleId,
			new Scalar<>(MainExampleTable.INSTANCE.getTableName())
		).from(
			ReferenceExampleTable.INSTANCE
		).leftJoinOn(
			MainExampleTable.INSTANCE,
			ReferenceExampleTable.INSTANCE.referenceExampleId.eq(
				MainExampleTable.INSTANCE.classPK)
		).leftJoinOn(
			ClassNameTable.INSTANCE,
			ClassNameTable.INSTANCE.classNameId.eq(
				MainExampleTable.INSTANCE.classNameId)
		).where(
			() -> {
				Predicate predicate =
					MainExampleTable.INSTANCE.mainExampleId.isNull();
				Scalar<String> key = new Scalar<>("key");
				return predicate.and(
					key.eq(MainExampleTable.INSTANCE.name)
				).and(
					MainExampleTable.INSTANCE.flag.eq(0)
				).and(
					ClassNameTable.INSTANCE.value.eq(
						TableReferenceInfoFactoryTest.class.getName())
				).and(
					ReferenceExampleTable.INSTANCE.referenceExampleId.
						isNotNull()
				).and(
					ReferenceExampleTable.INSTANCE.referenceExampleId.neq(
						0L)
				);
			}
		));
	ReferenceExampleTable aliasReferenceExampleTable =
		ReferenceExampleTable.INSTANCE.as("aliasParentTable");
	_assertMissingRequirementsSQL(
		parentTableJoinHoldersMap.get(ReferenceExampleTable.INSTANCE),
		DSLQueryFactoryUtil.select(
			ReferenceExampleTable.INSTANCE.mainExampleId,
			new Scalar<>(ReferenceExampleTable.INSTANCE.getTableName())
		).from(
			ReferenceExampleTable.INSTANCE
		).leftJoinOn(
			aliasReferenceExampleTable,
			ReferenceExampleTable.INSTANCE.parentReferenceExampleId.eq(
				aliasReferenceExampleTable.referenceExampleId)
		).where(
			() -> {
				Predicate predicate =
					aliasReferenceExampleTable.referenceExampleId.isNull();
				return predicate.and(
					ReferenceExampleTable.INSTANCE.parentReferenceExampleId.
						isNotNull()
				).and(
					ReferenceExampleTable.INSTANCE.parentReferenceExampleId.
						neq(0L)
				);
			}
		));
	_assertMissingRequirementsSQL(
		parentTableJoinHoldersMap.get(StringIntExampleTable.INSTANCE),
		DSLQueryFactoryUtil.select(
			ReferenceExampleTable.INSTANCE.mainExampleId,
			new Scalar<>(StringIntExampleTable.INSTANCE.getTableName())
		).from(
			ReferenceExampleTable.INSTANCE
		).leftJoinOn(
			StringIntExampleTable.INSTANCE,
			ReferenceExampleTable.INSTANCE.stringKey.eq(
				StringIntExampleTable.INSTANCE.stringKey
			).and(
				ReferenceExampleTable.INSTANCE.integerKey.eq(
					StringIntExampleTable.INSTANCE.integerKey)
			)
		).where(
			() -> {
				Predicate predicate =
					StringIntExampleTable.INSTANCE.id.isNull();
				return predicate.and(
					ReferenceExampleTable.INSTANCE.stringKey.isNotNull()
				).and(
					ReferenceExampleTable.INSTANCE.stringKey.neq("")
				).and(
					ReferenceExampleTable.INSTANCE.integerKey.isNotNull()
				);
			}
		));
}