Test method for com.rtg.mode.Protein(). @throws InvocationTargetException @throws IllegalAccessException @throws IllegalArgumentException @throws NoSuchMethodException @throws SecurityException
()
| 52 | * @throws SecurityException |
| 53 | */ |
| 54 | public final void test() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { |
| 55 | // Check toString of values |
| 56 | final String methodName = "values"; |
| 57 | Method m = Protein.class.getMethod(methodName); |
| 58 | final Protein[] r = (Protein[]) m.invoke(null); |
| 59 | assertEquals("[X, *, A, R, N, D, C, Q, E, G, H, I, L, K, M, F, P, S, T, W, Y, V]", Arrays.toString(r)); |
| 60 | final String valueOfMethod = "valueOf"; |
| 61 | m = Protein.class.getMethod(valueOfMethod, String.class); |
| 62 | // Check ordinal and valueOf |
| 63 | for (int i = 0; i < r.length; ++i) { |
| 64 | assertEquals(i, r[i].ordinal()); |
| 65 | if (r[i] != Protein.STOP) { |
| 66 | assertEquals(r[i], m.invoke(null, r[i].toString())); |
| 67 | assertEquals(Protein.valueOf(r[i].toString()), r[i]); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | //Copied from the IUPAC page |
| 73 | private static final String STR = "" |
nothing calls this directly
no test coverage detected