### Question:
MarketTenor implements Comparable<MarketTenor>, Serializable { public static MarketTenor ofSpot(Tenor tenor) { if (tenor.getPeriod().equals(Period.ofDays(1))) { return MarketTenor.SN; } if (tenor.getPeriod().equals(Period.ofDays(7))) { return MarketTenor.SW; } return new MarketTenor(tenor.toString(), tenor, MARKET_CONVENTION_LAG); } private  MarketTenor(String code, Tenor tenor, int spotLagIndicator); static MarketTenor ofSpot(Tenor tenor); @FromString static MarketTenor parse(String toParse); String getCode(); Tenor getTenor(); boolean isNonStandardSpotLag(); DaysAdjustment adjustSpotLag(DaysAdjustment marketConventionalSpotLag); @Override int compareTo(MarketTenor other); @Override boolean equals(Object obj); @Override int hashCode(); @ToString @Override String toString(); static final MarketTenor ON; static final MarketTenor TN; static final MarketTenor SN; static final MarketTenor SW; }### Answer:
@Test public void test_ofSpot_special() { assertThat(MarketTenor.ofSpot(TENOR_1W)).isEqualTo(MarketTenor.SW); assertThat(MarketTenor.ofSpot(TENOR_1D)).isEqualTo(MarketTenor.SN); }
@Test public void test_compare() { List<MarketTenor> tenors = ImmutableList.of( MarketTenor.ON, MarketTenor.TN, MarketTenor.SN, MarketTenor.ofSpot(Tenor.ofDays(2)), MarketTenor.ofSpot(Tenor.ofDays(6)), MarketTenor.SW, MarketTenor.ofSpot(Tenor.ofDays(8)), MarketTenor.ofSpot(Tenor.ofMonths(1))); List<MarketTenor> test = new ArrayList<>(tenors); Collections.shuffle(test); Collections.sort(test); assertThat(test).isEqualTo(tenors); }