@@ -1748,7 +1748,7 @@ func testIATBatchAddenda99Count(t testing.TB) {
17481748 mockBatch .Entries [0 ].Addenda14 = mockAddenda14 ()
17491749 mockBatch .Entries [0 ].Addenda15 = mockAddenda15 ()
17501750 mockBatch .Entries [0 ].Addenda16 = mockAddenda16 ()
1751- mockBatch . Entries [ 0 ]. AddAddenda17 ( mockAddenda17 ())
1751+ // Addenda17 and Addenda18 must not be included in IAT return entries
17521752 mockBatch .Entries [0 ].Addenda99 = mockIATAddenda99 ()
17531753 mockBatch .category = CategoryReturn
17541754
@@ -1757,7 +1757,6 @@ func testIATBatchAddenda99Count(t testing.TB) {
17571757 }
17581758
17591759 err := mockBatch .Validate ()
1760- // TODO: are we expecting there to be no errors here?
17611760 if ! base .Match (err , nil ) {
17621761 t .Errorf ("%T: %s" , err , err )
17631762 }
@@ -1777,6 +1776,54 @@ func BenchmarkIATBatchAddenda99Count(b *testing.B) {
17771776 }
17781777}
17791778
1779+ // TestIATBatchReturnAddendaError tests that Addenda17 and Addenda18 are not allowed in IAT return entries
1780+ func TestIATBatchReturnAddendaError (t * testing.T ) {
1781+ tests := []struct {
1782+ name string
1783+ setupEntry func (* IATEntryDetail )
1784+ description string
1785+ }{
1786+ {
1787+ name : "Addenda17" ,
1788+ setupEntry : func (entry * IATEntryDetail ) {
1789+ entry .AddAddenda17 (mockAddenda17 ())
1790+ },
1791+ description : "Addenda17 should not be allowed in IAT return entries" ,
1792+ },
1793+ {
1794+ name : "Addenda18" ,
1795+ setupEntry : func (entry * IATEntryDetail ) {
1796+ entry .AddAddenda18 (mockAddenda18 ())
1797+ },
1798+ description : "Addenda18 should not be allowed in IAT return entries" ,
1799+ },
1800+ }
1801+
1802+ for _ , tt := range tests {
1803+ t .Run (tt .name , func (t * testing.T ) {
1804+ mockBatch := IATBatch {}
1805+ mockBatch .SetHeader (mockIATReturnBatchHeaderFF ())
1806+ mockBatch .AddEntry (mockIATEntryDetail ())
1807+ mockBatch .GetEntries ()[0 ].Category = CategoryReturn
1808+ mockBatch .Entries [0 ].Addenda10 = mockAddenda10 ()
1809+ mockBatch .Entries [0 ].Addenda11 = mockAddenda11 ()
1810+ mockBatch .Entries [0 ].Addenda12 = mockAddenda12 ()
1811+ mockBatch .Entries [0 ].Addenda13 = mockAddenda13 ()
1812+ mockBatch .Entries [0 ].Addenda14 = mockAddenda14 ()
1813+ mockBatch .Entries [0 ].Addenda15 = mockAddenda15 ()
1814+ mockBatch .Entries [0 ].Addenda16 = mockAddenda16 ()
1815+ tt .setupEntry (mockBatch .Entries [0 ])
1816+ mockBatch .Entries [0 ].Addenda99 = mockIATAddenda99 ()
1817+ mockBatch .category = CategoryReturn
1818+
1819+ err := mockBatch .Validate ()
1820+ if ! base .Match (err , ErrFieldInclusion ) {
1821+ t .Errorf ("%s: %T: %s" , tt .description , err , err )
1822+ }
1823+ })
1824+ }
1825+ }
1826+
17801827// TestIATBatchAddenda98TotalCount validates IATBatch Addenda98 TotalCount
17811828func TestIATBatchAddenda98TotalCount (t * testing.T ) {
17821829 mockBatch := IATBatch {}
0 commit comments