### Question:
SQLTemplate extends AbstractQuery implements ParameterizedQuery { public synchronized String getTemplate(String key) { if (templates == null) { return defaultTemplate; } String template = templates.get(key); return (template != null) ? template : defaultTemplate; } SQLTemplate();  SQLTemplate(String defaultTemplate, boolean isFetchingDataRows);  SQLTemplate(DataMap rootMap, String defaultTemplate, boolean isFetchingDataRows);  SQLTemplate(ObjEntity rootEntity, String defaultTemplate);  SQLTemplate(Class<?> rootClass, String defaultTemplate);  SQLTemplate(DbEntity rootEntity, String defaultTemplate);  SQLTemplate(String objEntityName, String defaultTemplate); void setResultColumnsTypes(Class<?> ...types); @Override void setRoot(Object value); @Override void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery); @Override QueryMetadata getMetaData(EntityResolver resolver); @Override SQLAction createSQLAction(SQLActionVisitor visitor); void initWithProperties(Map<String, ?> properties); @SuppressWarnings("unchecked") Iterator<Map<String, ?>> parametersIterator(); int parametersSize(); @SuppressWarnings("unchecked") void setParams(Map<String, ?> params); void setParamsArray(Object... params); void setParamsList(List<Object> params); SQLTemplate queryWithParameters(Map<String, ?>... parameters); @Override Query createQuery(Map<String, ?> parameters); int getFetchLimit(); void setFetchLimit(int fetchLimit); int getFetchOffset(); void setFetchOffset(int fetchOffset); int getPageSize(); void setPageSize(int pageSize); void setFetchingDataRows(boolean flag); boolean isFetchingDataRows(); String getDefaultTemplate(); void setDefaultTemplate(String string); synchronized String getTemplate(String key); synchronized String getCustomTemplate(String key); synchronized void setTemplate(String key, String template); synchronized void removeTemplate(String key); synchronized Collection<String> getTemplateKeys(); Map<String, ?> getParams(); List<Object> getPositionalParams(); Map<String, ?> getParameters(); @SuppressWarnings("unchecked") void setParameters(Map<String, ?>... parameters); PrefetchTreeNode getPrefetchTree(); PrefetchTreeNode addPrefetch(String prefetchPath); void addPrefetch(PrefetchTreeNode prefetchElement); void removePrefetch(String prefetch); void addPrefetches(Collection<String> prefetches); void clearPrefetches(); CapsStrategy getColumnNamesCapitalization(); void setColumnNamesCapitalization(CapsStrategy columnNameCapitalization); void setResult(SQLResult resultSet); SQLResult getResult(); void setStatementFetchSize(int size); int getStatementFetchSize(); void setQueryTimeout(int queryTimeout); int getQueryTimeout(); String getDataNodeName(); void setDataNodeName(String dataNodeName); boolean isReturnGeneratedKeys(); void setReturnGeneratedKeys(boolean returnGeneratedKeys); List<Class<?>> getResultColumnsTypes(); void setResultColumnsTypes(List<Class<?>> resultColumnsTypes); void setUseScalar(boolean useScalar); boolean isUseScalar(); void setResultMapper(Function<?,?> resultMapper); static final String COLUMN_NAME_CAPITALIZATION_PROPERTY; }### Answer:
@Test public void testGetTemplate() { SQLTemplate query = new SQLTemplate(); assertNull(query.getTemplate("key1")); query.setDefaultTemplate("AAA # BBB"); assertEquals("AAA # BBB", query.getTemplate("key1")); query.setTemplate("key1", "XYZ"); assertEquals("XYZ", query.getTemplate("key1")); query.setTemplate("key2", "123"); assertEquals("XYZ", query.getTemplate("key1")); assertEquals("123", query.getTemplate("key2")); }